【问题标题】:Segmentation Fault using Julia LibCurl Wrapper使用 Julia LibCurl Wrapper 的分段错误
【发布时间】:2019-11-18 01:27:35
【问题描述】:

使用 Julia LibCurl.jl 运行以下代码

curl_header_list = Cstring[]

for header in keys(headers)
    value = headers[header]
    item =Cstring(pointer("$header: $value"))
    push!(curl_header_list, item)
end


curl_easy_setopt(curl, CURLOPT_URL, "$burl/api/v1/order/bulk")
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, curl_header_list)

res = curl_easy_perform(curl);

我们收到以下分段错误错误消息:

signal (11): Segmentation fault
in expression starting at /home/ubuntu/speed_test.jl:208
Curl_safe_strcasecompare at /home/ubuntu/.julia/packages/LibCURL/lWJxD/deps/usr/lib/libcurl.so (unknown line)
Allocations: 3088296 (Pool: 3087464; Big: 832); GC: 6
Segmentation fault (core dumped)

【问题讨论】:

    标签: curl julia libcurl


    【解决方案1】:

    尝试使用 HTTP.jl?

    using HTTP, JSON
    headers = Dict("Content-Type" => "application/json; charset=UTF-8")
    url_2request = "https://your.url/abc"
    #url_2request *= "?" * join(map(x -> x[1] * "=" * x[2], collect(params_dic)), "&")  # GET method
    query_json  = JSON.json(Dict("query_id" => "1",
                                 "version" => "1.0"))
    r = HTTP.request("POST", url_2request, headers, query_json)
    rs = String(r.body)
    

    【讨论】:

      猜你喜欢
      • 2014-12-23
      • 1970-01-01
      • 2011-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-19
      • 2011-07-05
      • 1970-01-01
      相关资源
      最近更新 更多