Go to file
Jay Satiro b1d08d295f http: set content length earlier
- Make content length (ie download size) accessible to the user in the
  header callback, but only after all headers have been processed (ie
  only in the final call to the header callback).

Background:

For a long time the content length could be retrieved in the header
callback via CURLINFO_CONTENT_LENGTH_DOWNLOAD_T as soon as it was parsed
by curl.

Changes were made in 8a16e54 (precedes 7.79.0) to ignore content length
if any transfer encoding is used. A side effect of that was that
content length was not set by libcurl until after the header callback
was called the final time, because until all headers are processed it
cannot be determined if content length is valid.

This change keeps the same intention --all headers must be processed--
but now the content length is available before the final call to the
header function that indicates all headers have been processed (ie
a blank header).

Bug: https://github.com/curl/curl/commit/8a16e54#r57374914
Reported-by: sergio-nsk@users.noreply.github.com

Co-authored-by: Daniel Stenberg

Fixes https://github.com/curl/curl/issues/7804
Closes https://github.com/curl/curl/pull/7803
2021-10-15 03:40:16 -04:00
.circleci CI/makefiles: introduce dedicated test target 2021-10-08 20:16:15 +02:00
.github CI/makefiles: introduce dedicated test target 2021-10-08 20:16:15 +02:00
.lift ci: update Lift config to match requirements of curl build 2021-09-23 12:57:04 +02:00
CMake CMake: remove HAVE_WINSOCK_H definition 2021-09-29 15:54:36 +02:00
docs docs/Makefile.am: repair 'make html' 2021-10-14 07:46:13 +02:00
include CURLOPT_MAXLIFETIME_CONN: maximum allowed lifetime for conn reuse 2021-10-06 14:38:59 +02:00
lib http: set content length earlier 2021-10-15 03:40:16 -04:00
m4 curl-openssl.m4: modify library order for openssl linking 2021-10-08 10:50:57 +02:00
packages CURLOPT_MAXLIFETIME_CONN: maximum allowed lifetime for conn reuse 2021-10-06 14:38:59 +02:00
plan9 copyright: fix year ranges 2020-11-05 08:22:10 +01:00
projects docs: Fix typos 2021-07-03 22:11:26 +02:00
scripts scripts/delta: hide a git error message we don't care about 2021-10-02 23:36:51 +02:00
src curl: correct grammar in generated libcurl code 2021-10-13 00:33:20 +02:00
tests aws-sigv4: make signature work when post data is binary 2021-10-15 08:46:23 +02:00
winbuild winbuild/README.md: clarify GEN_PDB option 2021-08-09 13:02:52 -04:00
zuul.d zuul.d/jobs: disable three tests for *-openssl-disable-proxy 2021-09-13 17:28:41 +02:00
.azure-pipelines.yml CI/makefiles: introduce dedicated test target 2021-10-08 20:16:15 +02:00
.cirrus.yml CI/makefiles: introduce dedicated test target 2021-10-08 20:16:15 +02:00
.dcignore .dcignore: ignore tests and docs directories 2020-06-27 00:07:37 +02:00
.dir-locals.el curl.se: new home 2020-11-04 23:59:47 +01:00
.gitattributes gitattributes: Set batch files to CRLF line endings on checkout 2021-01-14 15:59:56 -05:00
.gitignore .gitignore: add directory containing the stats repo 2020-06-05 19:54:34 +02:00
.lgtm.yml metalink: remove 2021-06-07 08:14:25 +02:00
.mailmap aws-sigv4: make signature work when post data is binary 2021-10-15 08:46:23 +02:00
acinclude.m4 misc: fix a few issues on MidnightBSD 2021-10-05 08:35:24 +02:00
appveyor.yml CI/makefiles: introduce dedicated test target 2021-10-08 20:16:15 +02:00
buildconf buildconf: exec autoreconf to avoid additional process 2020-08-29 21:43:49 +02:00
buildconf.bat curl.se: new home 2020-11-04 23:59:47 +01:00
CHANGES curl.se: new home 2020-11-04 23:59:47 +01:00
CMakeLists.txt cmake: add CURL_ENABLE_SSL option and make CMAKE_USE_* SSL backend options depend on it 2021-10-14 16:47:04 +02:00
configure.ac configure: remove HAVE_WINSOCK_H definition 2021-09-29 15:54:40 +02:00
COPYING COPYING/configure: bump copyright year range 2021-01-01 00:52:28 +01:00
curl-config.in curl.se: new home 2020-11-04 23:59:47 +01:00
GIT-INFO GIT-INFO: rephrase to adapt to s/buildconf/autoreconf 2021-09-24 13:14:52 +02:00
libcurl.pc.in Revert "libcurl.pc: make it relocatable" 2020-11-09 09:13:06 +01:00
MacOSX-Framework MacOSX-Framework: remove redundant ';' 2021-10-15 08:08:14 +02:00
Makefile.am CI/makefiles: introduce dedicated test target 2021-10-08 20:16:15 +02:00
Makefile.dist configure: provide --with-openssl, deprecate --with-ssl 2021-04-15 09:08:34 +02:00
maketgz maketgz: redirect updatemanpages.pl output to /dev/null 2021-10-08 15:16:34 +02:00
README curl.se: new home 2020-11-04 23:59:47 +01:00
README.md CI: remove travis details 2021-06-29 17:42:57 +02:00
RELEASE-NOTES RELEASE-NOTES: synced 2021-10-14 23:04:27 +02:00
SECURITY.md

curl logo

CII Best Practices Coverity passed AppVeyor Build Status Azure DevOps Build Status Cirrus Build Status Backers on Open Collective Sponsors on Open Collective Language Grade: C/C++ Codacy Badge Fuzzing Status

Curl is a command-line tool for transferring data specified with URL syntax. Find out how to use curl by reading the curl.1 man page or the MANUAL document. Find out how to install Curl by reading the INSTALL document.

libcurl is the library curl is using to do its job. It is readily available to be used by your software. Read the libcurl.3 man page to learn how!

You can find answers to the most frequent questions we get in the FAQ document.

Study the COPYING file for distribution terms.

Contact

If you have problems, questions, ideas or suggestions, please contact us by posting to a suitable mailing list.

All contributors to the project are listed in the THANKS document.

Commercial support

For commercial support, maybe private and dedicated help with your problems or applications using (lib)curl: https://curl.se/support.html

Website

Visit the curl website for the latest news and downloads.

Git

To download the very latest source from the Git server do this:

git clone https://github.com/curl/curl.git

(you'll get a directory named curl created, filled with the source code)

Security problems

Report suspected security problems via our HackerOne page and not in public!

Notice

Curl contains pieces of source code that is Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan. This notice is included here to comply with the distribution terms.

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]