Issue #16298: In HTTPResponse.read(), close the socket when there is no Content-Length and the incoming stream is finished.

Patch by Eran Rundstein.
This commit is contained in:
Antoine Pitrou 2012-12-15 19:11:54 +01:00
parent e0035a212b
commit 084daa2f74
4 changed files with 23 additions and 1 deletions

View file

@ -511,6 +511,10 @@ class HTTPResponse(io.RawIOBase):
self.length -= len(s)
if not self.length:
self.close()
else:
if not s:
self.close()
return s
def _read_chunked(self, amt):