CURLOPT_IGNORE_CONTENT_LENGTH.3 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. .\" generated by cd2nroff 0.1 from CURLOPT_IGNORE_CONTENT_LENGTH.md
  2. .TH CURLOPT_IGNORE_CONTENT_LENGTH 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_IGNORE_CONTENT_LENGTH \- ignore content length
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_IGNORE_CONTENT_LENGTH,
  9. long ignore);
  10. .fi
  11. .SH DESCRIPTION
  12. If \fIignore\fP is set to 1L, ignore the Content\-Length header in the HTTP
  13. response and ignore asking for or relying on it for FTP transfers.
  14. This is useful for doing HTTP transfers with ancient web servers which report
  15. incorrect content length for files over 2 gigabytes. If this option is used,
  16. curl cannot accurately report progress, and it instead stops the download when
  17. the server ends the connection.
  18. It is also useful with FTP when for example the file is growing while the
  19. transfer is in progress which otherwise unconditionally causes libcurl to
  20. report error.
  21. Only use this option if strictly necessary.
  22. .SH DEFAULT
  23. 0
  24. .SH PROTOCOLS
  25. This functionality affects ftp and http
  26. .SH EXAMPLE
  27. .nf
  28. int main(void)
  29. {
  30. CURL *curl = curl_easy_init();
  31. if(curl) {
  32. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  33. /* we know the server is silly, ignore content-length */
  34. curl_easy_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
  35. curl_easy_perform(curl);
  36. }
  37. }
  38. .fi
  39. .SH HISTORY
  40. Support for FTP added in 7.46.0.
  41. .SH NOTES
  42. This option is not working for HTTP when libcurl is built to use the hyper
  43. backend.
  44. .SH AVAILABILITY
  45. Added in curl 7.14.1
  46. .SH RETURN VALUE
  47. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  48. .SH SEE ALSO
  49. .BR CURLOPT_HTTP_VERSION (3),
  50. .BR CURLOPT_MAXFILESIZE_LARGE (3)