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_DOWN‐
12 LOAD_T,
13 curl_off_t *content_length);
14
16 Pass a pointer to a curl_off_t to receive the content-length of the
17 download. This is the value read from the Content-Length: field. Stores
18 -1 if the size isn't known.
19
21 HTTP(S)
22
24 CURL *curl = curl_easy_init();
25 if(curl) {
26 curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
27
28 /* Perform the request */
29 res = curl_easy_perform(curl);
30
31 if(!res) {
32 /* check the size */
33 curl_off_t cl;
34 res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &cl);
35 if(!res) {
36 printf("Download size: %" CURL_FORMAT_CURL_OFF_T "\n", cl);
37 }
38 }
39 }
40
42 Added in 7.55.0
43
45 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
46 if not.
47
49 curl_easy_getinfo(3), curl_easy_setopt(3), CURLINFO_CON‐
50 TENT_LENGTH_UPLOAD_T(3),
51
52
53
54libcurl 7.69.1 March 31,C2U0R1L8INFO_CONTENT_LENGTH_DOWNLOAD_T(3)