mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-113199: Make read1() and readline() of HTTPResponse close IO after reading all data (GH-113200)
This commit is contained in:
parent
2feec0fc7f
commit
41336a72b9
3 changed files with 21 additions and 2 deletions
|
@ -665,6 +665,8 @@ class HTTPResponse(io.BufferedIOBase):
|
|||
self._close_conn()
|
||||
elif self.length is not None:
|
||||
self.length -= len(result)
|
||||
if not self.length:
|
||||
self._close_conn()
|
||||
return result
|
||||
|
||||
def peek(self, n=-1):
|
||||
|
@ -689,6 +691,8 @@ class HTTPResponse(io.BufferedIOBase):
|
|||
self._close_conn()
|
||||
elif self.length is not None:
|
||||
self.length -= len(result)
|
||||
if not self.length:
|
||||
self._close_conn()
|
||||
return result
|
||||
|
||||
def _read1_chunked(self, n):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue