hgext/largefiles/proto.py
changeset 19006 0b3b84222a2d
parent 19005 1b84047e7d16
child 19009 07e40d589b64
--- a/hgext/largefiles/proto.py	Tue Apr 16 01:55:57 2013 +0200
+++ b/hgext/largefiles/proto.py	Tue Apr 16 04:35:10 2013 +0200
@@ -126,6 +126,13 @@
             # SSH streams will block if reading more than length
             for chunk in util.filechunkiter(stream, 128 * 1024, length):
                 yield chunk
+            # HTTP streams must hit the end to process the last empty
+            # chunk of Chunked-Encoding so the connection can be reused.
+            if issubclass(self.__class__, httppeer.httppeer):
+                chunk = stream.read(1)
+                if chunk:
+                    self._abort(error.ResponseError(_("unexpected response:"),
+                                                    chunk))
 
         @batchable
         def statlfile(self, sha):