Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: MethodError: no method matching curl_debug_cb(::Ptr{Nothing}, ::Int32, ::Ptr{Nothing}, ::UInt64, ::Ptr{Nothing}) #4

Closed
kafisatz opened this issue Oct 10, 2023 · 4 comments · Fixed by #5

Comments

@kafisatz
Copy link

Hi
and thanks again for your package.

when using verbose = true, I get the error below

curl = CurlHTTP.CurlEasy(url=url,method=CurlHTTP.POST,verbose=true)

In my case the second last argument of curl_debug_cb, is a UInt64, but the signature expects 32.
Any idea how to fix this?

julia>     url = baseurl * "/api/v2/torrents/delete"
"http://10.14.15.205:8080/api/v2/torrents/delete"

julia>     curl = CurlHTTP.CurlEasy(url=url,method=CurlHTTP.POST,verbose=true)
CurlHTTP.CurlEasy(Ptr{Nothing} @0x000001f7cdd07120, Ptr{Nothing} @0x0000000000000000, UUID("89fd6b90-6752-11ee-0b55-d31ea0b90d2e"), Dict{Any, Any}())

julia>     headers = ["$(first(keys(cookieDict))): $(first(values(cookieDict)))"]
1-element Vector{String}:
 "SID: PdG5Ue99ipQwE3SSGnXk1pWoYUk0jV3O"

julia>     requestBody = "{\"hashes\":\"$h\",\"deleteFiles\":$deletefiles}"
"{\"hashes\":\"05e9cc2061074485d136faeb6a9d781261552fe6\",\"deleteFiles\":true}"

julia>     println(requestBody)
{"hashes":"05e9cc2061074485d136faeb6a9d781261552fe6","deleteFiles":true}

julia>     res, http_status, errormessage = CurlHTTP.curl_execute(curl, requestBody, headers)
ERROR: MethodError: no method matching curl_debug_cb(::Ptr{Nothing}, ::Int32, ::Ptr{Nothing}, ::UInt64, ::Ptr{Nothing})

Closest candidates are:
  curl_debug_cb(::Ptr{Nothing}, ::Int32, ::Ptr{Nothing}, ::UInt32, ::Ptr{Nothing})
   @ CurlHTTP C:\Users\bernhard.koenig\.julia\packages\CurlHTTP\y4NoH\src\CurlHTTP.jl:477

Stacktrace:
 [1] curl_easy_perform(curl::Ptr{Nothing})
   @ LibCURL C:\Users\bernhard.koenig\.julia\juliaup\julia-1.9.3+0.x64.w64.mingw32\share\julia\stdlib\v1.9\LibCURL\src\lC_curl_h.jl:162
 [2] curl_easy_perform(curl::CurlHTTP.CurlEasy)
   @ CurlHTTP C:\Users\bernhard.koenig\.julia\packages\CurlHTTP\y4NoH\src\CurlHTTP.jl:324
 [3] curl_execute(curl::CurlHTTP.CurlEasy, requestBody::String, headers::Vector{String}; data_handler::CurlHTTP.var"#9#10"{Symbol, Vector{UInt8}}, header_handler::CurlHTTP.var"#9#10"{Symbol, Vector{String}}, url::String)      
   @ CurlHTTP C:\Users\bernhard.koenig\.julia\packages\CurlHTTP\y4NoH\src\CurlHTTP.jl:759
 [4] curl_execute(curl::CurlHTTP.CurlEasy, requestBody::String, headers::Vector{String})
   @ CurlHTTP C:\Users\bernhard.koenig\.julia\packages\CurlHTTP\y4NoH\src\CurlHTTP.jl:748
 [5] top-level scope
   @ REPL[490]:1



julia> ```
@bluesmoon
Copy link
Owner

Let me look into this.

@bluesmoon
Copy link
Owner

Ok, I think the bug is that I used Culong instead of Csize_t in the definition for curl_debug_cb, which works correctly on 64 bit machines, but will fail on 32 or 16 bit. I'll fix it asap.

@kafisatz
Copy link
Author

strangely my machine is 64 bit (for all I know).
i think your fix should work for me though.
Although I wonder why you need a type declaration on that variable at all...

@bluesmoon
Copy link
Owner

type declaration is required because it is called from the libcurl C library.

I don't understand why it would work on some machines but not others, but it seems that Csize_t is the same as UInt64 on 64 bit machines, while it is UInt32 on 32 bit machines.

@bluesmoon bluesmoon linked a pull request Oct 12, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants