Skip to content

Commit 040a8b4

Browse files
authored
Add support for CURLOPT_UNIX_SOCKET_PATH (#124)
1 parent 41bed54 commit 040a8b4

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
* Add support for proxy types CURLPROXY_HTTPS and CURLPROXY_HTTPS2.
44
(Volker Diels-Grabsch)
5+
* Add support for CURLOPT_UNIX_SOCKET_PATH.
6+
(Volker Diels-Grabsch)
57

68
## 0.10.0 - 14 May 2025
79

config/discover.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ let curl_h_declarations = [
291291
"CURLOPT_TIMEOUT_MS";
292292
"CURLOPT_TIMEVALUE";
293293
"CURLOPT_TRANSFERTEXT";
294+
"CURLOPT_UNIX_SOCKET_PATH";
294295
"CURLOPT_UNRESTRICTED_AUTH";
295296
"CURLOPT_UPLOAD";
296297
"CURLOPT_URL";

curl-helper.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3459,6 +3459,10 @@ SETOPT_LONG( BUFFERSIZE)
34593459
SETOPT_STRING( AWS_SIGV4)
34603460
#endif
34613461

3462+
#if HAVE_DECL_CURLOPT_UNIX_SOCKET_PATH
3463+
SETOPT_STRING( UNIX_SOCKET_PATH)
3464+
#endif
3465+
34623466
/* Windows headers define these symbols and there is no (sane) way to
34633467
* prevent macro expansion */
34643468

@@ -3921,6 +3925,11 @@ HAVE(TCP_KEEPALIVE),
39213925
HAVE(TCP_KEEPIDLE),
39223926
HAVE(TCP_KEEPINTVL),
39233927
HAVE(NOPROXY),
3928+
#if HAVE_DECL_CURLOPT_UNIX_SOCKET_PATH
3929+
HAVE(UNIX_SOCKET_PATH),
3930+
#else
3931+
HAVENOT(UNIX_SOCKET_PATH),
3932+
#endif
39243933
};
39253934

39263935
value caml_curl_easy_setopt(value conn, value option)

curl.ml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ type curlOption =
518518
| CURLOPT_TCP_KEEPIDLE of int
519519
| CURLOPT_TCP_KEEPINTVL of int
520520
| CURLOPT_NOPROXY of string
521+
| CURLOPT_UNIX_SOCKET_PATH of string
521522

522523
type initOption =
523524
| CURLINIT_GLOBALALL
@@ -1165,6 +1166,9 @@ let set_proxy_ssl_options conn opts =
11651166
let set_noproxy conn s =
11661167
setopt conn (CURLOPT_NOPROXY s)
11671168

1169+
let set_unix_socket_path conn unix_socket_path =
1170+
setopt conn (CURLOPT_UNIX_SOCKET_PATH unix_socket_path)
1171+
11681172
let get_effectiveurl conn =
11691173
match (getinfo conn CURLINFO_EFFECTIVE_URL) with
11701174
| CURLINFO_String s -> s
@@ -1527,6 +1531,7 @@ class handle =
15271531
method set_tcpkeepidle seconds = set_tcpkeepidle conn seconds
15281532
method set_tcpkeepintvl seconds = set_tcpkeepintvl conn seconds
15291533
method set_noproxy s = set_noproxy conn s
1534+
method set_unix_socket_path unix_socket_path = set_unix_socket_path conn unix_socket_path
15301535

15311536
method get_effectiveurl = get_effectiveurl conn
15321537
method get_redirecturl = get_redirecturl conn

curl.mli

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ type curlOption =
530530
| CURLOPT_TCP_KEEPIDLE of int
531531
| CURLOPT_TCP_KEEPINTVL of int
532532
| CURLOPT_NOPROXY of string
533+
| CURLOPT_UNIX_SOCKET_PATH of string (* @since libcurl 7.40.0 *)
533534

534535
type initOption =
535536
| CURLINIT_GLOBALALL
@@ -911,6 +912,7 @@ val set_mimepost : t -> curlMIMEPart list -> unit
911912
val set_sshknownhosts : t -> string -> unit
912913
val set_sshkeyfunction : t -> (curlKHMatch -> string -> curlKHStat) -> unit
913914
val set_noproxy : t -> string -> unit
915+
val set_unix_socket_path : t -> string -> unit
914916

915917
(** {2 Get transfer properties} *)
916918

@@ -1129,6 +1131,7 @@ class handle :
11291131
method set_tcpkeepidle : int -> unit
11301132
method set_tcpkeepintvl : int -> unit
11311133
method set_noproxy : string -> unit
1134+
method set_unix_socket_path : string -> unit
11321135

11331136
method get_effectiveurl : string
11341137
method get_redirecturl : string

0 commit comments

Comments
 (0)