1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_ABSTRACT_UNIX_SOCKET
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_UNIX_SOCKET_PATH (3)
9  - unix (7)
10Protocol:
11  - All
12Added-in: 7.53.0
13---
14
15# NAME
16
17CURLOPT_ABSTRACT_UNIX_SOCKET - abstract Unix domain socket
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ABSTRACT_UNIX_SOCKET,
25                          char *path);
26~~~
27
28# DESCRIPTION
29
30Enables the use of an abstract Unix domain socket instead of establishing a
31TCP connection to a host. The parameter should be a char * to a
32null-terminated string holding the path of the socket. The path is set to
33*path* prefixed by a NULL byte. This is the convention for abstract
34sockets, however it should be stressed that the path passed to this function
35should not contain a leading NULL byte.
36
37On non-supporting platforms, the abstract address is interpreted as an empty
38string and fails gracefully, generating a runtime error.
39
40This option shares the same semantics as CURLOPT_UNIX_SOCKET_PATH(3) in
41which documentation more details can be found. Internally, these two options
42share the same storage and therefore only one of them can be set per handle.
43
44# DEFAULT
45
46NULL
47
48# %PROTOCOLS%
49
50# EXAMPLE
51
52~~~c
53int main(void)
54{
55  CURL *curl = curl_easy_init();
56  if(curl) {
57    curl_easy_setopt(curl, CURLOPT_ABSTRACT_UNIX_SOCKET, "/tmp/foo.sock");
58    curl_easy_setopt(curl, CURLOPT_URL, "http://localhost/");
59
60    /* Perform the request */
61    curl_easy_perform(curl);
62  }
63}
64~~~
65
66# %AVAILABILITY%
67
68# RETURN VALUE
69
70Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
71