Mercurial > public > mercurial-scm > hg
comparison mercurial/httprepo.py @ 5982:b6bd4ee6ed85
move __del__ from httprepository to basehttphandler
This should prevent the next patch from reopening an issue fixed by
0d94e4a3ddb4.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sun, 03 Feb 2008 21:03:46 -0200 |
parents | d5b9c74c910e |
children | 6f1fcbc58efa |
comparison
equal
deleted
inserted
replaced
5981:ca2af0c81c9a | 5982:b6bd4ee6ed85 |
---|---|
104 send = _gen_sendfile(keepalive.HTTPConnection) | 104 send = _gen_sendfile(keepalive.HTTPConnection) |
105 | 105 |
106 class basehttphandler(keepalive.HTTPHandler): | 106 class basehttphandler(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 | |
110 def __del__(self): | |
111 self.close_all() | |
109 | 112 |
110 has_https = hasattr(urllib2, 'HTTPSHandler') | 113 has_https = hasattr(urllib2, 'HTTPSHandler') |
111 if has_https: | 114 if has_https: |
112 class httpsconnection(httplib.HTTPSConnection): | 115 class httpsconnection(httplib.HTTPSConnection): |
113 response_class = keepalive.HTTPResponse | 116 response_class = keepalive.HTTPResponse |
201 self.ui = ui | 204 self.ui = ui |
202 self.ui.debug(_('using %s\n') % self._url) | 205 self.ui.debug(_('using %s\n') % self._url) |
203 | 206 |
204 proxyurl = ui.config("http_proxy", "host") or os.getenv('http_proxy') | 207 proxyurl = ui.config("http_proxy", "host") or os.getenv('http_proxy') |
205 # XXX proxyauthinfo = None | 208 # XXX proxyauthinfo = None |
206 self.handler = httphandler() | 209 handlers = [httphandler()] |
207 handlers = [self.handler] | |
208 | 210 |
209 if proxyurl: | 211 if proxyurl: |
210 # proxy can be proper url or host[:port] | 212 # proxy can be proper url or host[:port] |
211 if not (proxyurl.startswith('http:') or | 213 if not (proxyurl.startswith('http:') or |
212 proxyurl.startswith('https:')): | 214 proxyurl.startswith('https:')): |
268 | 270 |
269 # 1.0 here is the _protocol_ version | 271 # 1.0 here is the _protocol_ version |
270 opener.addheaders = [('User-agent', 'mercurial/proto-1.0')] | 272 opener.addheaders = [('User-agent', 'mercurial/proto-1.0')] |
271 urllib2.install_opener(opener) | 273 urllib2.install_opener(opener) |
272 | 274 |
273 def __del__(self): | |
274 if self.handler: | |
275 self.handler.close_all() | |
276 self.handler = None | |
277 | |
278 def url(self): | 275 def url(self): |
279 return self.path | 276 return self.path |
280 | 277 |
281 # look up capabilities only when needed | 278 # look up capabilities only when needed |
282 | 279 |