CURLOPT_IPRESOLVE(3)
okay bestie, welcome to the CURLOPT_IPRESOLVE(3) page from the Library Functions Manual β we're talking about picking which IP protocol version to use, and it's honestly iconic π
π NAME π
CURLOPT_IPRESOLVE β the IP protocol version to use β¨
π¦ SYNOPSIS π¦
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_IPRESOLVE, long resolve);
πΈ DESCRIPTION πΈ
This one lets an application choose what kind of IP addresses to use when it's establishing a connection or choosing one from the connection pool. It's super interesting when you're using hostnames that resolve to more than one IP family β like, okay, which one are we actually picking? π
quick heads-up: if the URL provided for a transfer contains a numerical IP version as a host name, this option does not override or prohibit libcurl from using that IP version. no cap.
Available values for this option are:
CURL_IPRESOLVE_WHATEVERβ default, can use addresses of all IP versions that your system allows πCURL_IPRESOLVE_V4β uses only IPv4 addresses πCURL_IPRESOLVE_V6β uses only IPv6 addresses π¦
π DEFAULT π
CURL_IPRESOLVE_WHATEVER β periodt.
π PROTOCOLS π
This functionality affects all supported protocols β
π EXAMPLE π
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
/* of all addresses example.com resolves to, only IPv6 ones are used */
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
}
π§ HISTORY π§
The CURL_IPRESOLVE_* macros became long types in 8.15.0; before this version a long cast was necessary when passed to curl_easy_setopt(3) β³
π AVAILABILITY π
Added in curl 7.10.8 β¨
π₯ 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) π
π SEE ALSO π
bye bestie π«Ά this page is from libcurl, dated 2026-10-12 β and yes, the footer vibe is immaculate π
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms