1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_IGNORE_CONTENT_LENGTH 5Section: 3 6Source: libcurl 7Protocol: 8 - HTTP 9 - FTP 10See-also: 11 - CURLOPT_HTTP_VERSION (3) 12 - CURLOPT_MAXFILESIZE_LARGE (3) 13Added-in: 7.14.1 14--- 15 16# NAME 17 18CURLOPT_IGNORE_CONTENT_LENGTH - ignore content length 19 20# SYNOPSIS 21 22~~~c 23#include <curl/curl.h> 24 25CURLcode curl_easy_setopt(CURL *handle, CURLOPT_IGNORE_CONTENT_LENGTH, 26 long ignore); 27~~~ 28 29# DESCRIPTION 30 31If *ignore* is set to 1L, ignore the Content-Length header in the HTTP 32response and ignore asking for or relying on it for FTP transfers. 33 34This is useful for doing HTTP transfers with ancient web servers which report 35incorrect content length for files over 2 gigabytes. If this option is used, 36curl cannot accurately report progress, and it instead stops the download when 37the server ends the connection. 38 39It is also useful with FTP when for example the file is growing while the 40transfer is in progress which otherwise unconditionally causes libcurl to 41report error. 42 43Only use this option if strictly necessary. 44 45# DEFAULT 46 470 48 49# %PROTOCOLS% 50 51# EXAMPLE 52 53~~~c 54int main(void) 55{ 56 CURL *curl = curl_easy_init(); 57 if(curl) { 58 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 59 60 /* we know the server is silly, ignore content-length */ 61 curl_easy_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L); 62 63 curl_easy_perform(curl); 64 } 65} 66~~~ 67 68# HISTORY 69 70Support for FTP added in 7.46.0. 71 72# NOTES 73 74This option is not working for HTTP when libcurl is built to use the hyper 75backend. 76 77# %AVAILABILITY% 78 79# RETURN VALUE 80 81Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 82