summaryrefslogtreecommitdiff
path: root/Lib/httplib.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-12-15 19:11:54 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2012-12-15 19:11:54 +0100
commit4113d2bd368480bc3f2cae36e5562cb601305737 (patch)
treeb1e35ce7f52475fb2deac6cd3de2440cc06c41da /Lib/httplib.py
parenteea058b0143e98ef902a3931895aa99252059ef0 (diff)
downloadcpython-git-4113d2bd368480bc3f2cae36e5562cb601305737.tar.gz
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/httplib.py')
-rw-r--r--Lib/httplib.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py
index 4c8b0fe209..39a388e805 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -565,6 +565,10 @@ class HTTPResponse:
self.length -= len(s)
if not self.length:
self.close()
+ else:
+ if not s:
+ self.close()
+
return s
def _read_chunked(self, amt):