Skip to content

Commit 2eb0491

Browse files
fix wrong definition of curl_socket_t on Windows
1 parent 4c1d2af commit 2eb0491

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

src/Curl/Curl.jl

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,35 @@ export
2626
remove_handle
2727

2828
using LibCURL
29-
using LibCURL: curl_off_t
29+
using LibCURL: curl_off_t, libcurl
3030
# not exported: https://github.com/JuliaWeb/LibCURL.jl/issues/87
3131

3232
# constants that LibCURL should have but doesn't
3333
const CURLE_PEER_FAILED_VERIFICATION = 60
3434
const CURLSSLOPT_REVOKE_BEST_EFFORT = 1 << 3
3535

36+
# these are incorrectly defined on Windows by LibCURL:
37+
if Sys.iswindows()
38+
const curl_socket_t = Base.OS_HANDLE
39+
const CURL_SOCKET_TIMEOUT = Base.INVALID_OS_HANDLE
40+
else
41+
const curl_socket_t = Cint
42+
const CURL_SOCKET_TIMEOUT = -1
43+
end
44+
45+
# definitions affected by incorrect curl_socket_t (copied verbatim):
46+
function curl_multi_socket_action(multi_handle, s, ev_bitmask, running_handles)
47+
ccall((:curl_multi_socket_action, libcurl), CURLMcode, (Ptr{CURLM}, curl_socket_t, Cint, Ptr{Cint}), multi_handle, s, ev_bitmask, running_handles)
48+
end
49+
function curl_multi_assign(multi_handle, sockfd, sockp)
50+
ccall((:curl_multi_assign, libcurl), CURLMcode, (Ptr{CURLM}, curl_socket_t, Ptr{Cvoid}), multi_handle, sockfd, sockp)
51+
end
52+
53+
# additional curl_multi_socket_action method
54+
function curl_multi_socket_action(multi_handle, s, ev_bitmask)
55+
curl_multi_socket_action(multi_handle, s, ev_bitmask, Ref{Cint}())
56+
end
57+
3658
using FileWatching
3759
using NetworkOptions
3860
using Base: OS_HANDLE, preserve_handle, unpreserve_handle

src/Curl/utils.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ macro check(ex::Expr)
3131
end
3232
end
3333

34-
# additional libcurl methods
35-
36-
function curl_multi_socket_action(multi_handle, s, ev_bitmask)
37-
LibCURL.curl_multi_socket_action(multi_handle, s, ev_bitmask, Ref{Cint}())
38-
end
39-
4034
# curl string list structure
4135

4236
struct curl_slist_t

0 commit comments

Comments
 (0)