mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #20007: HTTPResponse.read(0) no more prematurely closes connection.
Original patch by Simon Sapin.
This commit is contained in:
commit
cac05e2e90
4 changed files with 8 additions and 1 deletions
|
@ -538,7 +538,7 @@ class HTTPResponse(io.RawIOBase):
|
|||
# connection, and the user is reading more bytes than will be provided
|
||||
# (for example, reading in 1k chunks)
|
||||
n = self.fp.readinto(b)
|
||||
if not n:
|
||||
if not n and b:
|
||||
# Ideally, we would raise IncompleteRead if the content-length
|
||||
# wasn't satisfied, but it might break compatibility.
|
||||
self._close_conn()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue