GNURLOPT_ADDRESS_SCOPE(3)
β¨ GNURLOPT_ADDRESS_SCOPE(3) β¨
okay so quick vibe check: this is a page from the curl_easy_setopt options manual fam β yes, the very same curl_easy_setopt universe you already know and love. pull up a chair bestie π
π NAME π
CURLOPT_ADDRESS_SCOPE β sets the scope id for IPv6 addresses. no cap, that's literally its whole job π¦
πΈ SYNOPSIS πΈ
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ADDRESS_SCOPE, long
scope);
π DESCRIPTION π
so what you're gonna do is pass a long that specifies the scope id value to use when you're connecting to IPv6 addresses. that's it. that's the whole thing. iconic, minimal, does exactly what it says on the tin β¨
π«Ά DEFAULT π«Ά
0
π PROTOCOLS π
All of them β but only when you're using IPv6, bestie. it's giving "works everywhere, but only in v6 land" π
π§ EXAMPLE π§
okay here's the whole thing in action, copy-paste ready, you're welcome:
CURL *curl = curl_easy_init();
if(curl) {
CURLcode ret;
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);
ret = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
see how if_nametoindex("eth0") just hands you the scope id? slay. we love a clean handoff π€
β AVAILABILITY β
Added in 7.19.0 β so it's been around, it's not new new, it's been serving looks since forever π
π₯ RETURN VALUE π₯
CURLE_OKβ returned if the option is supported π₯³CURLE_UNKNOWN_OPTIONβ returned if it's not supported πCURLE_BAD_FUNCTION_ARGUMENTβ returned if you set it to a negative value π
lowkey watch out for that last one β negative values are not the move, and this is how it tells you.
π SEE ALSO π
okay that's the whole page, go forth and scope responsibly π β¨
libcurl 7.37.0 Β· 19 Jun 2014 β mwah, that's the tea, dated and versioned and everything, catch you in the next manpage bestie ππ¦π
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms