diff Lib/http/client.py @ 74271:4b21f651eeee

Issue #13713: fix a regression in HTTP chunked reading after 806cfe39f729 (originally issue #13464: Add a readinto() method to http.client.HTTPResponse)
author Antoine Pitrou <solipsis@pitrou.net>
date Wed, 04 Jan 2012 18:57:22 +0100
parents daaacc0ec584
children 1acb252a3858
line wrap: on
line diff
--- a/Lib/http/client.py	Wed Jan 04 10:12:14 2012 -0600
+++ b/Lib/http/client.py	Wed Jan 04 18:57:22 2012 +0100
@@ -603,12 +603,12 @@
             if len(mvb) < chunk_left:
                 n = self._safe_readinto(mvb)
                 self.chunk_left = chunk_left - n
-                return n
+                return total_bytes + n
             elif len(mvb) == chunk_left:
                 n = self._safe_readinto(mvb)
                 self._safe_read(2)  # toss the CRLF at the end of the chunk
                 self.chunk_left = None
-                return n
+                return total_bytes + n
             else:
                 temp_mvb = mvb[0:chunk_left]
                 n = self._safe_readinto(temp_mvb)