##// END OF EJS Templates
httprepo: use separate handlers for HTTP and HTTPS...
Alexis S. L. Carvalho -
r5983:6f1fcbc5 default
parent child Browse files
Show More
@@ -103,7 +103,7 b' class httpconnection(keepalive.HTTPConne'
103 103 # must be able to send big bundle as stream.
104 104 send = _gen_sendfile(keepalive.HTTPConnection)
105 105
106 class basehttphandler(keepalive.HTTPHandler):
106 class httphandler(keepalive.HTTPHandler):
107 107 def http_open(self, req):
108 108 return self.do_open(httpconnection, req)
109 109
@@ -117,12 +117,9 b' if has_https:'
117 117 # must be able to send big bundle as stream.
118 118 send = _gen_sendfile(httplib.HTTPSConnection)
119 119
120 class httphandler(basehttphandler, urllib2.HTTPSHandler):
120 class httpshandler(keepalive.KeepAliveHandler, urllib2.HTTPSHandler):
121 121 def https_open(self, req):
122 122 return self.do_open(httpsconnection, req)
123 else:
124 class httphandler(basehttphandler):
125 pass
126 123
127 124 # In python < 2.5 AbstractDigestAuthHandler raises a ValueError if
128 125 # it doesn't know about the auth type requested. This can happen if
@@ -207,6 +204,8 b' class httprepository(remoterepository):'
207 204 proxyurl = ui.config("http_proxy", "host") or os.getenv('http_proxy')
208 205 # XXX proxyauthinfo = None
209 206 handlers = [httphandler()]
207 if has_https:
208 handlers.append(httpshandler())
210 209
211 210 if proxyurl:
212 211 # proxy can be proper url or host[:port]
@@ -175,7 +175,7 b' class ConnectionManager:'
175 175 else:
176 176 return dict(self._hostmap)
177 177
178 class HTTPHandler(urllib2.HTTPHandler):
178 class KeepAliveHandler:
179 179 def __init__(self):
180 180 self._cm = ConnectionManager()
181 181
@@ -314,6 +314,9 b' class HTTPHandler(urllib2.HTTPHandler):'
314 314 except socket.error, err: # XXX what error?
315 315 raise urllib2.URLError(err)
316 316
317 class HTTPHandler(KeepAliveHandler, urllib2.HTTPHandler):
318 pass
319
317 320 class HTTPResponse(httplib.HTTPResponse):
318 321 # we need to subclass HTTPResponse in order to
319 322 # 1) add readline() and readlines() methods
General Comments 0
You need to be logged in to leave comments. Login now