CURLOPT_ADDRESS_SCOPE(3)

πŸ’– CURLOPT_ADDRESS_SCOPE(3) πŸ’–

okay bestie, this page is chilling in the Library Functions Manual and it's fully about the scope id for IPv6 addresses. it's giving tiny-but-iconic setopt energy, no cap. πŸ¦‹

🌸 NAME 🌸

CURLOPT_ADDRESS_SCOPE β€” scope id for IPv6 addresses ✨

πŸŽ€ SYNOPSIS πŸŽ€

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ADDRESS_SCOPE, long scope);

πŸ’… DESCRIPTION πŸ’…

Pass a long specifying the scope id value to use when connecting to IPv6 addresses. that's the whole vibe, bestie β€” a long, a scope id, and IPv6. periodt. πŸ’œ

πŸ“ DEFAULT πŸ“

0 β€” yep, zero is the default, fr fr.

🌈 PROTOCOLS 🌈

This functionality affects all supported protocols. literally all the supported ones, bestie. ✨

🧚 EXAMPLE 🧚

#include <net/if.h> /* for if_nametoindex() */

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    long my_scope_id;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
    my_scope_id = if_nametoindex("eth0");
    curl_easy_setopt(curl, CURLOPT_ADDRESS_SCOPE, my_scope_id);
    result = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
  }
}

⭐ AVAILABILITY ⭐

Added in curl 7.19.0 β€” iconic since then, iykyk. πŸ’«

πŸ’€ 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). Returns CURLE_BAD_FUNCTION_ARGUMENT if set to a negative value. so yeah, don't be negative, bestie πŸ˜­πŸ’…

🫢 SEE ALSO 🫢


mwah πŸ’‹ this cutie page is from libcurl, dated 2026-10-12, and it's the CURLOPT_ADDRESS_SCOPE(3) page β€” slay. πŸ‘‘

πŸ“¦ where this page comes from