New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http: set content length earlier #7803
Conversation
8e819f9
to
d1a3e96
Compare
changed it to deduplicate a separate similar check that occurs after all headers have been received |
some hyper tests for maximum filesize are failing so I have to look into that. the other CI failures don't make sense, they are all ignored tests but fail anyway, for example this one:
|
That certainly looks like a test script bug! |
@jay I believe my fixup addressed the remaining issue. Anything left or should this get merged? |
- 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: curl@8a16e54#r57374914 Reported-by: sergio-nsk@users.noreply.github.com Co-authored-by: Daniel Stenberg Fixes curl#7804 Closes #xxxx
a56502a
to
8b55769
Compare
Thanks, that seems to have done it. I've squashed it, rebased on master and will wait for another round of CI results. |
All of the failures look like random flakiness, however one of them in windows msys1_mingw32_debug was test 566 which is content length related, so I'm rerunning that CI until it passes. |
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: 8a16e54#r57374914
Reported-by: sergio-nsk@users.noreply.github.com
Fixes #7804
Closes #xxxx