CURLINFO_C...H_DOWNLOAD(3)
π CURLINFO_CONTENT_LENGTH_DOWNLOAD(3) π
πΈ NAME πΈ
okay so this page lives in the Library Functions Manual, bestie, and it is all about CURLINFO_CONTENT_LENGTH_DOWNLOAD β content-length of download. no cap π
β¨ SYNOPSIS β¨
first things first, here is the include and the function signature, exactly as they come:
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD,
double *content_length);
π¦ DESCRIPTION π¦
Pass a pointer to a double to receive the content-length of the download. This is the value read from the Content-Length: field. This returns -1 if the size is not known. periodt π
CURLINFO_CONTENT_LENGTH_DOWNLOAD_T(3) is a newer replacement that returns a more sensible variable type. iykyk β¨
π PROTOCOLS π
This functionality affects all supported protocols. literally all of them, bestie π¦
π EXAMPLE π
here is the whole example, copied with love and zero edits:
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 */
double cl;
result = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &cl);
if(!result) {
printf("Size: %.0f\n", cl);
}
}
}
}
π DEPRECATED π
Deprecated since 7.55.0. sad but true, bestie π
β AVAILABILITY β
Added in curl 7.6.1. iconic vintage behavior π
π«Ά RETURN VALUE π«Ά
curl_easy_getinfo(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3). that is the whole vibe check β
π SEE ALSO π
mwah π this little page comes from libcurl, dated 2026-10-12, and now you know your content-length download tea, bestie. π¦β¨π
π¦ 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