diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-12-15 18:22:30 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-12-15 18:22:30 (GMT) |
commit | d20e7745eeb99c5f2089b5b6ffa351658cb4e839 (patch) | |
tree | 018ae0d638f113f4c06ac52db5c9e50a1f0e8378 /Lib/http | |
parent | 30505413df61f1cd7d550d6b90e08e691c62479a (diff) | |
parent | 084daa2f7492ae809b5ce09d2cdbad6ed5a71848 (diff) | |
download | cpython-d20e7745eeb99c5f2089b5b6ffa351658cb4e839.zip cpython-d20e7745eeb99c5f2089b5b6ffa351658cb4e839.tar.gz cpython-d20e7745eeb99c5f2089b5b6ffa351658cb4e839.tar.bz2 |
Issue #16298: In HTTPResponse.read(), close the socket when there is no Content-Length and the incoming stream is finished.
Patch by Eran Rundstein.
Diffstat (limited to 'Lib/http')
-rw-r--r-- | Lib/http/client.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/http/client.py b/Lib/http/client.py index 9b01704..6a4496f 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -536,6 +536,9 @@ class HTTPResponse(io.RawIOBase): self.length -= n if not self.length: self.close() + else: + if not n: + self.close() return n def _read_next_chunk_size(self): |