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