Skip to content
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

gh-128271: fix incorrect handling of negative read sizes in HTTPResponse.read() #128270

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
2 changes: 2 additions & 0 deletions Lib/http/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,8 @@ def _get_chunk_left(self):

def _read_chunked(self, amt=None):
assert self.chunked != _UNKNOWN
if amt is not None and amt < 0:
amt = None
value = []
try:
while (chunk_left := self._get_chunk_left()) is not None:
Expand Down
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better to link to previous bug report #112064

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix incorrect handling of negative read sizes in :meth:`HTTPResponse.read
<http.client.HTTPResponse.read>`. Patch by [email protected]
picnixz marked this conversation as resolved.
Show resolved Hide resolved
Loading