diff --git a/CHANGES.txt b/CHANGES.txt index 7437c63..49b90f8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,8 @@ * Add support for proxy types CURLPROXY_HTTPS and CURLPROXY_HTTPS2. (Volker Diels-Grabsch) +* Add support for CURLOPT_UNIX_SOCKET_PATH. + (Volker Diels-Grabsch) ## 0.10.0 - 14 May 2025 diff --git a/config/discover.ml b/config/discover.ml index f7a9fc6..5b91ba7 100644 --- a/config/discover.ml +++ b/config/discover.ml @@ -291,6 +291,7 @@ let curl_h_declarations = [ "CURLOPT_TIMEOUT_MS"; "CURLOPT_TIMEVALUE"; "CURLOPT_TRANSFERTEXT"; + "CURLOPT_UNIX_SOCKET_PATH"; "CURLOPT_UNRESTRICTED_AUTH"; "CURLOPT_UPLOAD"; "CURLOPT_URL"; diff --git a/curl-helper.c b/curl-helper.c index ea51f8c..514129f 100644 --- a/curl-helper.c +++ b/curl-helper.c @@ -3459,6 +3459,10 @@ SETOPT_LONG( BUFFERSIZE) SETOPT_STRING( AWS_SIGV4) #endif +#if HAVE_DECL_CURLOPT_UNIX_SOCKET_PATH + SETOPT_STRING( UNIX_SOCKET_PATH) +#endif + /* Windows headers define these symbols and there is no (sane) way to * prevent macro expansion */ @@ -3921,6 +3925,11 @@ HAVE(TCP_KEEPALIVE), HAVE(TCP_KEEPIDLE), HAVE(TCP_KEEPINTVL), HAVE(NOPROXY), +#if HAVE_DECL_CURLOPT_UNIX_SOCKET_PATH + HAVE(UNIX_SOCKET_PATH), +#else + HAVENOT(UNIX_SOCKET_PATH), +#endif }; value caml_curl_easy_setopt(value conn, value option) diff --git a/curl.ml b/curl.ml index 65c3218..acefd2b 100644 --- a/curl.ml +++ b/curl.ml @@ -518,6 +518,7 @@ type curlOption = | CURLOPT_TCP_KEEPIDLE of int | CURLOPT_TCP_KEEPINTVL of int | CURLOPT_NOPROXY of string + | CURLOPT_UNIX_SOCKET_PATH of string type initOption = | CURLINIT_GLOBALALL @@ -1165,6 +1166,9 @@ let set_proxy_ssl_options conn opts = let set_noproxy conn s = setopt conn (CURLOPT_NOPROXY s) +let set_unix_socket_path conn unix_socket_path = + setopt conn (CURLOPT_UNIX_SOCKET_PATH unix_socket_path) + let get_effectiveurl conn = match (getinfo conn CURLINFO_EFFECTIVE_URL) with | CURLINFO_String s -> s @@ -1527,6 +1531,7 @@ class handle = method set_tcpkeepidle seconds = set_tcpkeepidle conn seconds method set_tcpkeepintvl seconds = set_tcpkeepintvl conn seconds method set_noproxy s = set_noproxy conn s + method set_unix_socket_path unix_socket_path = set_unix_socket_path conn unix_socket_path method get_effectiveurl = get_effectiveurl conn method get_redirecturl = get_redirecturl conn diff --git a/curl.mli b/curl.mli index 69e21dc..55b0dbd 100644 --- a/curl.mli +++ b/curl.mli @@ -530,6 +530,7 @@ type curlOption = | CURLOPT_TCP_KEEPIDLE of int | CURLOPT_TCP_KEEPINTVL of int | CURLOPT_NOPROXY of string + | CURLOPT_UNIX_SOCKET_PATH of string (* @since libcurl 7.40.0 *) type initOption = | CURLINIT_GLOBALALL @@ -911,6 +912,7 @@ val set_mimepost : t -> curlMIMEPart list -> unit val set_sshknownhosts : t -> string -> unit val set_sshkeyfunction : t -> (curlKHMatch -> string -> curlKHStat) -> unit val set_noproxy : t -> string -> unit +val set_unix_socket_path : t -> string -> unit (** {2 Get transfer properties} *) @@ -1129,6 +1131,7 @@ class handle : method set_tcpkeepidle : int -> unit method set_tcpkeepintvl : int -> unit method set_noproxy : string -> unit + method set_unix_socket_path : string -> unit method get_effectiveurl : string method get_redirecturl : string