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) 13--- 14 15# NAME 16 17CURLOPT_IGNORE_CONTENT_LENGTH - ignore content length 18 19# SYNOPSIS 20 21~~~c 22#include <curl/curl.h> 23 24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_IGNORE_CONTENT_LENGTH, 25 long ignore); 26~~~ 27 28# DESCRIPTION 29 30If *ignore* is set to 1L, ignore the Content-Length header in the HTTP 31response and ignore asking for or relying on it for FTP transfers. 32 33This is useful for doing HTTP transfers with ancient web servers which report 34incorrect content length for files over 2 gigabytes. If this option is used, 35curl cannot accurately report progress, and it instead stops the download when 36the server ends the connection. 37 38It is also useful with FTP when for example the file is growing while the 39transfer is in progress which otherwise unconditionally causes libcurl to 40report error. 41 42Only use this option if strictly necessary. 43 44# DEFAULT 45 460 47 48# EXAMPLE 49 50~~~c 51int main(void) 52{ 53 CURL *curl = curl_easy_init(); 54 if(curl) { 55 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 56 57 /* we know the server is silly, ignore content-length */ 58 curl_easy_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L); 59 60 curl_easy_perform(curl); 61 } 62} 63~~~ 64 65# AVAILABILITY 66 67Added in 7.14.1. Support for FTP added in 7.46.0. This option is not working 68for HTTP when libcurl is built to use the hyper backend. 69 70# RETURN VALUE 71 72Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 73