Original patch by Simon Sapin.
# 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()
sock = FakeSocket(body)
resp = client.HTTPResponse(sock)
resp.begin()
+ self.assertEqual(resp.read(0), b'') # Issue #20007
+ self.assertFalse(resp.isclosed())
+ self.assertFalse(resp.closed)
self.assertEqual(resp.read(), b"Text")
self.assertTrue(resp.isclosed())
self.assertFalse(resp.closed)
James Sanders
Ilya Sandler
Rafael Santos
+Simon Sapin
Mark Sapiro
Ty Sarna
Hugh Sasse
Library
-------
+- Issue #20007: HTTPResponse.read(0) no more prematurely closes connection.
+ Original patch by Simon Sapin.
+
- Issue #19912: Fixed numerous bugs in ntpath.splitunc().
- Issue #19911: ntpath.splitdrive() now correctly processes the 'İ' character