CURLOPT_AB...NIX_SOCKET(3)

πŸ’… CURLOPT_ABSTRACT_UNIX_SOCKET(3) πŸ’…

okay bestie, this is the libcurl Library Functions Manual page for CURLOPT_ABSTRACT_UNIX_SOCKET(3) β€” and honestly, abstract Unix sockets are lowkey iconic once you get the vibe. πŸ’–


🌸 NAME 🌸

CURLOPT_ABSTRACT_UNIX_SOCKET β€” abstract Unix domain socket. That's the whole name, no cap. ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ABSTRACT_UNIX_SOCKET,
                          char *path);

πŸ’œ DESCRIPTION πŸ’œ

okay so this option enables the use of an abstract Unix domain socket instead of establishing a TCP connection to a host. The parameter should be a char * pointing to a null-terminated string that holds the path of the socket. The path gets set to path prefixed by a NULL byte. That's the convention for abstract sockets, bestie.

But it should be stressed β€” like, big emphasis β€” that the path you pass to this function should not contain a leading NULL byte. Do not do that. πŸ™ˆ

On platforms that don't support this, the abstract address gets interpreted as an empty string and fails gracefully, generating a runtime error. Not the slayest outcome, but that's what the manual says. 😭

This option shares the same semantics as CURLOPT_UNIX_SOCKET_PATH(3) β€” more details can be found in that documentation. Internally, these two options share the same storage, and therefore only one of them can be set per handle. periodt. πŸ‘‘


πŸŽ€ DEFAULT πŸŽ€

The default is literally NULL. πŸ’…


🌈 PROTOCOLS 🌈

This functionality affects all supported protocols. All of them. Every single one. ✨


πŸ“ EXAMPLE πŸ“

Here's the example, exactly as the manual gives it β€” steal it for your own code, bestie:

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_ABSTRACT_UNIX_SOCKET, "/tmp/foo.sock");
    curl_easy_setopt(curl, CURLOPT_URL, "http://localhost/");

    /* Perform the request */
    curl_easy_perform(curl);
  }
}

⭐ AVAILABILITY ⭐

Added in curl 7.53.0. A little vintage, still serving. 🫢


πŸ’€ RETURN VALUE πŸ’€

curl_easy_setopt(3) returns a CURLcode indicating success or error.

CURLE_OK (0) means everything was OK. non-zero means an error occurred β€” see libcurl-errors(3). No mystery, just error codes. πŸ’…


🧚 SEE ALSO 🧚

Go read those too, iykyk. πŸ’–


That's the whole page, bestie. Sending you love from source/version: libcurl Β· date: 2026-10-12 β€” now go set that socket and slay πŸ’‹

πŸ“¦ where this page comes from