diff options
author | Facundo Batista <facundobatista@gmail.com> | 2007-10-18 03:16:03 (GMT) |
---|---|---|
committer | Facundo Batista <facundobatista@gmail.com> | 2007-10-18 03:16:03 (GMT) |
commit | 7066590736bb61b5f67ade490aeee327af4bc6e2 (patch) | |
tree | 4a98d6267b59eae611c7f0f116ea05b6fe368fc6 /Lib/httplib.py | |
parent | a1e42e11d51237a949ad2568f8a097d4b442fdec (diff) | |
download | cpython-7066590736bb61b5f67ade490aeee327af4bc6e2.zip cpython-7066590736bb61b5f67ade490aeee327af4bc6e2.tar.gz cpython-7066590736bb61b5f67ade490aeee327af4bc6e2.tar.bz2 |
Issue #1580738. When HTTPConnection reads the whole stream with read(),
it closes itself. When the stream is read in several calls to read(n),
it should behave in the same way if HTTPConnection knows where the end
of the stream is (through self.length). Added a test case for this
behaviour.
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r-- | Lib/httplib.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py index 8dbe8a0..dca9eca 100644 --- a/Lib/httplib.py +++ b/Lib/httplib.py @@ -530,7 +530,8 @@ class HTTPResponse: s = self.fp.read(amt) if self.length is not None: self.length -= len(s) - + if not self.length: + self.close() return s def _read_chunked(self, amt): |