Make HTTPResponse.read1 close response when all data is read#3235
Merged
illia-v merged 11 commits intourllib3:mainfrom Jan 22, 2024
Merged
Make HTTPResponse.read1 close response when all data is read#3235illia-v merged 11 commits intourllib3:mainfrom
HTTPResponse.read1 close response when all data is read#3235illia-v merged 11 commits intourllib3:mainfrom
Conversation
This was referenced Dec 15, 2023
pquentin
previously approved these changes
Dec 19, 2023
Member
pquentin
left a comment
There was a problem hiding this comment.
Looks great, thanks! Congrats in getting your CPython fix in.
sethmlarson
requested changes
Dec 19, 2023
sethmlarson
reviewed
Dec 19, 2023
Member
sethmlarson
left a comment
There was a problem hiding this comment.
Thanks for clarifying the behavior of read1() to me! I only had one review comment then this LGTM:
This is not required because `_raw_read` is not called by `read1` when `amt` is 0, but it makes `_raw_read` more explicit.
Member
Author
|
@sethmlarson @pquentin can we merge this? |
sethmlarson
previously approved these changes
Jan 22, 2024
Member
sethmlarson
left a comment
There was a problem hiding this comment.
Seems fine to me, I'm sad we're having to get so specific for http.client but since we're working around a bug in that implementation it makes sense. Thanks Illia!
sethmlarson
approved these changes
Jan 22, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #3216, we discovered that CPython's
http.client.HTTPResponse.read1never closes the response after all data has been read and content length was known.This PR adds a fix for the issue to
_raw_readnear a similar old fix that closes a response under a different condition.I'll create a PR to fix this in CPython too most likely.