CURLINFO_SPEED_DOWNLOAD(3)

πŸ’… CURLINFO_SPEED_DOWNLOAD(3) πŸ’…

okay so bestie, you're in the libcurl part of the manual (Library Functions Manual), and today's main character is CURLINFO_SPEED_DOWNLOAD β€” the download speed girlie. let's get into it πŸŽ€


✨ NAME ✨

CURLINFO_SPEED_DOWNLOAD β€” download speed. literally just download speed, that's the whole vibe πŸ¦‹


✨ SYNOPSIS ✨

#include <curl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SPEED_DOWNLOAD,
                           double *speed);

✨ DESCRIPTION ✨

so here's the tea β˜• β€” you pass a pointer to a double, and curl fills it with the average download speed it measured for the complete download. measured in bytes/second, no cap πŸ“₯πŸ”₯

lowkey important though: CURLINFO_SPEED_DOWNLOAD_T(3) is the newer replacement, and it returns a more sensible variable type. so like… this one still works, but the _T version is the upgraded, more sensible icon πŸ‘‘ β€” iykyk.


🌈 PROTOCOLS 🌈

this functionality affects all supported protocols. every single one. she's versatile πŸ’…βœ¨


✨ EXAMPLE ✨

here's how you'd actually use it, copy-paste style 🫢

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) {
      double speed;
      result = curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD, &speed);
      if(!result) {
        printf("Download speed %.0f bytes/sec\n", speed);
      }
    }
  }
}

πŸ’€ DEPRECATED πŸ’€

deprecated since 7.55.0. she's an icon, she's a legend, but she is deprecated β€” go use the _T one for new stuff, bestie 😭

⭐ AVAILABILITY ⭐

added in curl 7.4.1 β€” vintage, but make it fashion πŸŽ€


πŸ’– RETURN VALUE πŸ’–

curl_easy_getinfo(3) returns a CURLcode indicating success or error.

CURLE_OK (which is 0) means everything was OK πŸŽ‰ β€” non-zero means an error occurred, so go check libcurl-errors(3) to find out what went wrong πŸ™ˆ


πŸ¦‹ SEE ALSO πŸ¦‹


🌸 that's the whole page, no notes. brought to you by libcurl, dated 2026-10-12 β€” mwah, go measure some bytes per second πŸ’œπŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from