CURLINFO_PRETRANSFER_TIME(3)
π CURLINFO_PRETRANSFER_TIME π
ok so this is a page from the Library Functions Manual, bestie β CURLINFO_PRETRANSFER_TIME(3), to be exact. let's get into it β¨
πΈ NAME πΈ
CURLINFO_PRETRANSFER_TIME β literally the time it takes to get to the start of the transfer π«Ά
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PRETRANSFER_TIME,
double *timep);
π DESCRIPTION π
okay so picture this: you pass in a pointer to a double, and it gets filled with the time β in seconds β from the very start all the way up until the file transfer is just about to begin. like, the calm before the slay π
this time-stamp includes all the pre-transfer commands and negotiations that are specific to whatever protocol(s) you're dealing with. it includes sending the protocol-specific instructions that trigger a transfer. no cap, all of that is in there π₯
and when a redirect is followed? the time from each request gets added together. every single one. periodt π
also go check out the TIMES overview in the curl_easy_getinfo(3) man page β it's giving essential reading π
π¦ PROTOCOLS π¦
this functionality affects all supported protocols. all of them. every last one π
π EXAMPLE π
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
double pretransfer;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
result = curl_easy_perform(curl);
if(CURLE_OK == result) {
result = curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME,
&pretransfer);
if(CURLE_OK == result) {
printf("Time: %.1f", pretransfer);
}
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
β AVAILABILITY β
added in curl 7.4.1 β vintage icon behavior, honestly π
π RETURN VALUE π
curl_easy_getinfo(3) returns a CURLcode indicating success or error. that's it, that's the vibe check β¨
CURLE_OK (0) means everything was OK β slay π β and a non-zero value means an error occurred, so go peek at libcurl-errors(3) π
π₯ SEE ALSO π₯
and that's the whole page, bestie π§ this one came from libcurl dated 2026-10-12 β go forth and time your pretransfers ππ
π¦ 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