CURLINFO_C...DOWNLOAD_T(3)
π CURLINFO_C...DOWNLOAD_T(3) π
okay bestie, welcome to CURLINFO_C...DOWNLOAD_T(3), straight out of the Library Functions Manual. This is literally the manual page for peeking at how big a download is gonna be. Very demure, very http, no cap. π
π NAME π
CURLINFO_CONTENT_LENGTH_DOWNLOAD_T β content-length of download
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
curl_off_t *content_length);
πΈ DESCRIPTION πΈ
okay so you pass a pointer to a curl_off_t and it receives the content-length of the download. This is the value read from the Content-Length: field. If the size is not known, it stores -1. That's the whole tea. π«
π¦ PROTOCOLS π¦
This functionality affects http only. That's the only protocol on the guest list for this one. π
π₯ EXAMPLE π₯
Here's the example program, exactly as the manual shows it:
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) {
/* check the size */
curl_off_t cl;
result =
curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &cl);
if(!result) {
printf("Download size: %" CURL_FORMAT_CURL_OFF_T "\n", cl);
}
}
}
}
β AVAILABILITY β
Added in curl 7.55.0. π«
π RETURN VALUE π
curl_easy_getinfo(3)returns aCURLcodeindicating success or error.CURLE_OK(0) means everything was OK.- non-zero means an error occurred, see
libcurl-errors(3).
π SEE ALSO π
and that's the page, bestie π«Ά source/version: libcurl Β· date: 2026-10-12 Β· page: CURLINFO_C...DOWNLOAD_T(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