mercurial/httprepo.py
changeset 2557 1727ff712a4e
parent 2556 f1ebc4311f47
child 2569 52ce0d6bc375
--- a/mercurial/httprepo.py	Mon Jul 03 00:23:56 2006 -0300
+++ b/mercurial/httprepo.py	Mon Jul 03 00:23:58 2006 -0300
@@ -91,6 +91,22 @@
     def http_open(self, req):
         return self.do_open(httpconnection, req)
 
+class httpsconnection(httplib.HTTPSConnection):
+    # must be able to send big bundle as stream.
+
+    def send(self, data):
+        if isinstance(data, str):
+            httplib.HTTPSConnection.send(self, data)
+        else:
+            # if auth required, some data sent twice, so rewind here
+            data.seek(0)
+            for chunk in util.filechunkiter(data):
+                httplib.HTTPSConnection.send(self, chunk)
+
+class httpshandler(urllib2.HTTPSHandler):
+    def https_open(self, req):
+        return self.do_open(httpsconnection, req)
+
 class httprepository(remoterepository):
     def __init__(self, ui, path):
         self.caps = None
@@ -160,6 +176,7 @@
 
         opener = urllib2.build_opener(
             handler,
+            httpshandler(),
             urllib2.HTTPBasicAuthHandler(passmgr),
             urllib2.HTTPDigestAuthHandler(passmgr))