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 +
605605pub const CURLOPT_PROXY_CRLFILE : CURLoption = CURLOPTTYPE_OBJECTPOINT + 260 ;
606606pub const CURLOPT_PROXY_SSL_OPTIONS : CURLoption = CURLOPTTYPE_LONG + 261 ;
607607
608+ pub const CURLOPT_ABSTRACT_UNIX_SOCKET : CURLoption = CURLOPTTYPE_OBJECTPOINT + 264 ;
609+
608610pub const CURLOPT_DOH_URL : CURLoption = CURLOPTTYPE_OBJECTPOINT + 279 ;
609611pub const CURLOPT_UPLOAD_BUFFERSIZE : CURLoption = CURLOPTTYPE_LONG + 280 ;
610612
Original file line number Diff line number Diff line change @@ -170,6 +170,14 @@ impl Easy {
170170 self . inner . unix_socket_path ( path)
171171 }
172172
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+
173181 // =========================================================================
174182 // Callback options
175183
Original file line number Diff line number Diff line change @@ -807,6 +807,21 @@ impl<H> Easy2<H> {
807807 }
808808 }
809809
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+
810825 // =========================================================================
811826 // Internal accessors
812827
Original file line number Diff line number Diff line change @@ -219,7 +219,8 @@ fn main() {
219219 s == "CURLSSLOPT_NO_REVOKE" ||
220220
221221 // 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"
223224 } ) ;
224225
225226 if cfg ! ( target_env = "msvc" ) {
You can’t perform that action at this time.
0 commit comments