1CURLINFO_CONTENT_LENGTH_DOWNcLuOrAlD__eTa(s3y)_getinCfUoRLoIpNtFiOo_nCsONTENT_LENGTH_DOWNLOAD_T(3)
2
3
4
6 CURLINFO_CONTENT_LENGTH_DOWNLOAD_T - get content-length of download
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
12 curl_off_t *content_length);
13
15 Pass a pointer to a curl_off_t to receive the content-length of the
16 download. This is the value read from the Content-Length: field. Stores
17 -1 if the size is not known.
18
20 HTTP(S)
21
23 CURL *curl = curl_easy_init();
24 if(curl) {
25 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
26
27 /* Perform the request */
28 res = curl_easy_perform(curl);
29
30 if(!res) {
31 /* check the size */
32 curl_off_t cl;
33 res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &cl);
34 if(!res) {
35 printf("Download size: %" CURL_FORMAT_CURL_OFF_T "\n", cl);
36 }
37 }
38 }
39
41 Added in 7.55.0
42
44 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
45 if not.
46
48 curl_easy_getinfo(3), curl_easy_setopt(3), CURLINFO_CONTENT_LENGTH_UP‐
49 LOAD_T(3),
50
51
52
53libcurl 7.85.0 May 17, 2C0U2R2LINFO_CONTENT_LENGTH_DOWNLOAD_T(3)