1CURLOPT_IGNORE_CONTENT_LENGTcHu(r3l)_easy_setopt optCiUoRnLsOPT_IGNORE_CONTENT_LENGTH(3)
2
3
4
6 CURLOPT_IGNORE_CONTENT_LENGTH - ignore content length
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_IGNORE_CONTENT_LENGTH,
12 long ignore);
13
15 If ignore is set to 1L, ignore the Content-Length header in the HTTP
16 response and ignore asking for or relying on it for FTP transfers.
17
18 This is useful for HTTP with Apache 1.x (and similar servers) which
19 will report incorrect content length for files over 2 gigabytes. If
20 this option is used, curl will not be able to accurately report
21 progress, and will simply stop the download when the server ends the
22 connection.
23
24 It is also useful with FTP when for example the file is growing while
25 the transfer is in progress which otherwise will unconditionally cause
26 libcurl to report error.
27
28 Only use this option if strictly necessary.
29
31 0
32
34 HTTP
35
37 CURL *curl = curl_easy_init();
38 if(curl) {
39 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
40
41 /* we know the server is silly, ignore content-length */
42 curl_easy_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
43
44 curl_easy_perform(curl);
45 }
46
48 Added in 7.14.1. Support for FTP added in 7.46.0. This option is not
49 working for HTTP when libcurl is built to use the hyper backend.
50
52 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
53 if not.
54
56 CURLOPT_HTTP_VERSION(3), CURLOPT_MAXFILESIZE_LARGE(3),
57
58
59
60libcurl 7.85.0 May 17, 2022 CURLOPT_IGNORE_CONTENT_LENGTH(3)