CURLINFO_NAMELOOKUP_TIME(3)
CURLINFO_NAMELOOKUP_TIME(3) π
okay so bestie, welcome to the libcurl Library Functions Manual corner of the group chat π«Ά we're talking about CURLINFO_NAMELOOKUP_TIME, and it's giving βhow long did the name lookup takeβ energy.
πΈ NAME πΈ
CURLINFO_NAMELOOKUP_TIME β name lookup time. no cap, that's the whole vibe.
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NAMELOOKUP_TIME,
double *timep);
π DESCRIPTION π
You pass a pointer to a double, and it gets the total time in seconds from the start until the name resolving was completed. yes bestie, seconds, and it's a double, so cute and precise.
When a redirect is followed, the time from each request is added together. so redirects stack their times, fr fr.
Also go peek at the TIMES overview in the curl_easy_getinfo(3) man page β it's the bigger picture, iykyk.
π¦ PROTOCOLS π¦
This functionality affects all supported protocols π like, every supported protocol gets this energy.
π EXAMPLE π
here's the whole little C moment, copied exactly because we do not mess with code:
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
double namelookup;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
result = curl_easy_perform(curl);
if(CURLE_OK == result) {
result = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, &namelookup);
if(CURLE_OK == result) {
printf("Time: %.1f", namelookup);
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
π AVAILABILITY π
Added in curl 7.4.1 β iconic vintage behavior, but make it current. β¨
π RETURN VALUE π
curl_easy_getinfo(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) if things get messy π.
π«Ά SEE ALSO π«Ά
that's the page, bestie: brought to you by libcurl, dated 2026-10-12, and filed under CURLINFO_NAMELOOKUP_TIME(3) πβ¨
π¦ 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