File tree Expand file tree Collapse file tree 4 files changed +27
-1
lines changed Expand file tree Collapse file tree 4 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -605,6 +605,8 @@ pub const CURLOPT_PROXY_SSL_CIPHER_LIST: CURLoption = CURLOPTTYPE_OBJECTPOINT +
605
605
pub const CURLOPT_PROXY_CRLFILE : CURLoption = CURLOPTTYPE_OBJECTPOINT + 260 ;
606
606
pub const CURLOPT_PROXY_SSL_OPTIONS : CURLoption = CURLOPTTYPE_LONG + 261 ;
607
607
608
+ pub const CURLOPT_ABSTRACT_UNIX_SOCKET : CURLoption = CURLOPTTYPE_OBJECTPOINT + 264 ;
609
+
608
610
pub const CURLOPT_DOH_URL : CURLoption = CURLOPTTYPE_OBJECTPOINT + 279 ;
609
611
pub const CURLOPT_UPLOAD_BUFFERSIZE : CURLoption = CURLOPTTYPE_LONG + 280 ;
610
612
Original file line number Diff line number Diff line change @@ -170,6 +170,14 @@ impl Easy {
170
170
self . inner . unix_socket_path ( path)
171
171
}
172
172
173
+ /// Same as [`Easy2::abstract_unix_socket`](struct.Easy2.html#method.abstract_unix_socket)
174
+ ///
175
+ /// NOTE: this API can only be used on Linux OS.
176
+ #[ cfg( target_os = "linux" ) ]
177
+ pub fn abstract_unix_socket ( & mut self , addr : & [ u8 ] ) -> Result < ( ) , Error > {
178
+ self . inner . abstract_unix_socket ( addr)
179
+ }
180
+
173
181
// =========================================================================
174
182
// Callback options
175
183
Original file line number Diff line number Diff line change @@ -807,6 +807,21 @@ impl<H> Easy2<H> {
807
807
}
808
808
}
809
809
810
+ /// Provides the ABSTRACT UNIX SOCKET which this handle will work with.
811
+ ///
812
+ /// This function is an alternative to [`Easy2::unix_socket`] and [`Easy2::unix_socket_path`] that supports
813
+ /// ABSTRACT_UNIX_SOCKET(`man 7 unix` on Linux) address.
814
+ ///
815
+ /// By default this option is not set and corresponds to
816
+ /// [`CURLOPT_ABSTRACT_UNIX_SOCKET`](https://curl.haxx.se/libcurl/c/CURLOPT_ABSTRACT_UNIX_SOCKET.html).
817
+ ///
818
+ /// NOTE: this API can only be used on Linux OS.
819
+ #[ cfg( target_os = "linux" ) ]
820
+ pub fn abstract_unix_socket ( & mut self , addr : & [ u8 ] ) -> Result < ( ) , Error > {
821
+ let addr = CString :: new ( addr) ?;
822
+ self . setopt_str ( curl_sys:: CURLOPT_ABSTRACT_UNIX_SOCKET , & addr)
823
+ }
824
+
810
825
// =========================================================================
811
826
// Internal accessors
812
827
Original file line number Diff line number Diff line change @@ -219,7 +219,8 @@ fn main() {
219
219
s == "CURLSSLOPT_NO_REVOKE" ||
220
220
221
221
// A lot of curl versions doesn't support unix sockets
222
- s == "CURLOPT_UNIX_SOCKET_PATH" || s == "CURL_VERSION_UNIX_SOCKETS"
222
+ s == "CURLOPT_UNIX_SOCKET_PATH" || s == "CURL_VERSION_UNIX_SOCKETS" || s ==
223
+ "CURLOPT_ABSTRACT_UNIX_SOCKET"
223
224
} ) ;
224
225
225
226
if cfg ! ( target_env = "msvc" ) {
You can’t perform that action at this time.
0 commit comments