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