CURLINFO_SPEED_DOWNLOAD_T(3)
π CURLINFO_SPEED_DOWNLOAD_T π
okay bestie, so this one is a page from the Library Functions Manual β the curl gang's own little corner of the man pages β and it's genuinely so useful, i promise. it's all about finding out how fast your download was going. let's get into it π
β¨ NAME β¨
CURLINFO_SPEED_DOWNLOAD_T β download speed, aka the vibe check on how quick your bytes arrived π¦
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SPEED_DOWNLOAD_T,
curl_off_t *speed);
β¨ DESCRIPTION β¨
so the way this works is iconic: you hand over a pointer to a curl_off_t, and curl fills it in with the average download speed it measured for the complete download. that's the whole entire download, not some sample of it, okay?
and the unit? bytes/second. simple. slay. no conversion needed, no weird multiplier, it's giving straightforward π
ngl this is the "how did we do overall" number β average across the whole download, so don't come for it if it doesn't match the speed you saw at any one specific moment π
β¨ PROTOCOLS β¨
this functionality affects all supported protocols β like, every single one. no exclusions, no "well exceptβ". all of them. periodt π
β¨ EXAMPLE β¨
here's the little main character moment in full, exactly as written β¨
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Perform the request */
result = curl_easy_perform(curl);
if(!result) {
curl_off_t speed;
result = curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD_T, &speed);
if(!result) {
printf("Download speed %" CURL_FORMAT_CURL_OFF_T " bytes/sec\n",
speed);
}
}
}
}
see how it sets the URL, performs the request, then asks for the speed? that's the order, bestie β the info call comes after the perform. don't skip steps π«Ά
also lowkey obsessed with that CURL_FORMAT_CURL_OFF_T macro in the printf β it's there so the format string is correct for curl_off_t on whatever platform you're on. use it. always. it's not optional in spirit π
β¨ AVAILABILITY β¨
Added in curl 7.55.0 β so if your curl is older than that, this call simply isn't gonna happen for you, sorry bestie π
β¨ RETURN VALUE β¨
so curl_easy_getinfo(3) returns a CURLcode that tells you success or error. that's it, that's the return.
CURLE_OK(which is0) β everything was OK, you're so back π- non-zero β an error occurred π go check
libcurl-errors(3)to see which one it was
no cap, always check it. every single time. it's giving basic hygiene β¨
β¨ SEE ALSO β¨
go be nosy, bestie β these are all connected π
okay that's the whole page, you ate that π and for the record this lil beauty is brought to you by libcurl, dated 2026-10-12 β go forth and measure your speeds, icon ππ§
π¦ 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