##// END OF EJS Templates
HTTPS: fix python2.3, persistent connections, don't explode if SSL is not available...
Alexis S. L. Carvalho -
r2569:52ce0d6b default
parent child Browse files
Show More
@@ -87,11 +87,14 b' class httpconnection(keepalive.HTTPConne'
87 87 for chunk in util.filechunkiter(data):
88 88 keepalive.HTTPConnection.send(self, chunk)
89 89
90 class httphandler(keepalive.HTTPHandler):
90 class basehttphandler(keepalive.HTTPHandler):
91 91 def http_open(self, req):
92 92 return self.do_open(httpconnection, req)
93 93
94 has_https = hasattr(urllib2, 'HTTPSHandler')
95 if has_https:
94 96 class httpsconnection(httplib.HTTPSConnection):
97 response_class = keepalive.HTTPResponse
95 98 # must be able to send big bundle as stream.
96 99
97 100 def send(self, data):
@@ -103,9 +106,12 b' class httpsconnection(httplib.HTTPSConne'
103 106 for chunk in util.filechunkiter(data):
104 107 httplib.HTTPSConnection.send(self, chunk)
105 108
106 class httpshandler(urllib2.HTTPSHandler):
109 class httphandler(basehttphandler, urllib2.HTTPSHandler):
107 110 def https_open(self, req):
108 111 return self.do_open(httpsconnection, req)
112 else:
113 class httphandler(basehttphandler):
114 pass
109 115
110 116 class httprepository(remoterepository):
111 117 def __init__(self, ui, path):
@@ -176,7 +182,6 b' class httprepository(remoterepository):'
176 182
177 183 opener = urllib2.build_opener(
178 184 handler,
179 httpshandler(),
180 185 urllib2.HTTPBasicAuthHandler(passmgr),
181 186 urllib2.HTTPDigestAuthHandler(passmgr))
182 187
@@ -322,4 +327,8 b' class httprepository(remoterepository):'
322 327 os.unlink(tempname)
323 328
324 329 class httpsrepository(httprepository):
325 pass
330 def __init__(self, ui, path):
331 if not has_https:
332 raise util.Abort(_('Python support for SSL and HTTPS '
333 'is not installed'))
334 httprepository.__init__(self, ui, path)
General Comments 0
You need to be logged in to leave comments. Login now