summaryrefslogtreecommitdiffstats
path: root/Lib/httplib.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-12-17 19:49:48 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-12-17 19:49:48 (GMT)
commitc97f5ede8f15ab91b2bc224d6fd7c577b744af63 (patch)
tree021955b630c9659f651710dfdd8726f683e021b6 /Lib/httplib.py
parentea76e87cc26727d6ec8a139b3c9411154212e2ea (diff)
downloadcpython-c97f5ede8f15ab91b2bc224d6fd7c577b744af63.zip
cpython-c97f5ede8f15ab91b2bc224d6fd7c577b744af63.tar.gz
cpython-c97f5ede8f15ab91b2bc224d6fd7c577b744af63.tar.bz2
Issue #20007: HTTPResponse.read(0) no more prematurely closes connection.
Original patch by Simon Sapin.
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r--Lib/httplib.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py
index 5c919d2..56c3341 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -565,7 +565,7 @@ class HTTPResponse:
# connection, and the user is reading more bytes than will be provided
# (for example, reading in 1k chunks)
s = self.fp.read(amt)
- if not s:
+ if not s and amt:
# Ideally, we would raise IncompleteRead if the content-length
# wasn't satisfied, but it might break compatibility.
self.close()