GNURLINFO...OOKUP_TIME(3)
π
GNURLINFO...OOKUP_TIME(3) β the manual page formerly known as CURLINFO_NAMELOOKUP_TIME
okay so bestie, this one lives in the curl_easy_getinfo options section of the manual (that's the manual name, and yes it's a whole vibe), and it's all about finding out how long the DNS name lookup took. literally just that. iconic.
β¨ NAME β¨
CURLINFO_NAMELOOKUP_TIME β get the name lookup time π
π¦ SYNOPSIS π¦
#include <gnurl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_NAMELOOKUP_TIME,
double *timep);
πΈ DESCRIPTION πΈ
So here's the tea π: you pass in a pointer to a double, and it gets filled with the total time in seconds from the start of everything until the name resolving was completed. that's it, that's the whole thing.
when a redirect is followed, the time from each request gets added together β so you're getting the sum, not just the last hop. no cap. π
also, go peek at the TIMES overview in the curl_easy_getinfo(3) man page, iykyk. β¨
π PROTOCOLS π
All β every single one, we love an inclusive queen π
π EXAMPLE π
curl = curl_easy_init();
if(curl) {
double namelookup;
curl_easy_setopt(curl, CURLOPT_URL, url);
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, &namelookup);
if(CURLE_OK == res) {
printf("Time: %.1f", namelookup);
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
look at that. clean. slay. don't forget the cleanup at the end, bestie, that's the /* always cleanup */ energy we respect. π«Ά
β AVAILABILITY β
Added in 7.4.1 β she's been around a minute, an elder icon π
π₯ RETURN VALUE π₯
- Returns
CURLE_OKif the option is supported π - Returns
CURLE_UNKNOWN_OPTIONif it's not π
that's the whole vibe check, fr fr.
π SEE ALSO π
go read those too, they're all linked in the group chat π§
mwah π this page was brought to you by libcurl 7.44.0, dated 28 Aug 2015 β a vintage moment, and the header says GNURLINFO...OOKUP_TIME(3) if you were wondering where we came from. bye bestie, go measure some lookup times π¦β¨
π¦ 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