1CURLINFO_CONTENT_LENGTH_DOWNLOAD_T(3)libcurClURLINFO_CONTENT_LENGTH_DOWNLOAD_T(3)
2
3
4

NAME

6       CURLINFO_CONTENT_LENGTH_DOWNLOAD_T - get content-length of download
7

SYNOPSIS

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

DESCRIPTION

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

PROTOCOLS

20       HTTP(S)
21

EXAMPLE

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

AVAILABILITY

41       Added in 7.55.0
42

RETURN VALUE

44       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
45       if not.
46

SEE ALSO

48       curl_easy_getinfo(3), curl_easy_setopt(3),  CURLINFO_CONTENT_LENGTH_UP‐
49       LOAD_T(3),
50
51
52
53libcurl 8.2.1                   April 26,C2U0R2L3INFO_CONTENT_LENGTH_DOWNLOAD_T(3)
Impressum