Mercurial > public > mercurial-scm > hg
comparison mercurial/url.py @ 10408:50fb1fe143ff
url: httplib.HTTPSConnection already handles IPv6 and port parsing fine
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Wed, 10 Feb 2010 20:08:18 +0100 |
parents | 08a0f04b56bd |
children | 4c94a3df4b10 |
comparison
equal
deleted
inserted
replaced
10407:2e8926e9cc32 | 10408:50fb1fe143ff |
---|---|
456 | 456 |
457 def https_open(self, req): | 457 def https_open(self, req): |
458 self.auth = self.pwmgr.readauthtoken(req.get_full_url()) | 458 self.auth = self.pwmgr.readauthtoken(req.get_full_url()) |
459 return self.do_open(self._makeconnection, req) | 459 return self.do_open(self._makeconnection, req) |
460 | 460 |
461 def _makeconnection(self, host, port=443, *args, **kwargs): | 461 def _makeconnection(self, host, port=None, *args, **kwargs): |
462 keyfile = None | 462 keyfile = None |
463 certfile = None | 463 certfile = None |
464 | 464 |
465 if args: # key_file | 465 if args: # key_file |
466 keyfile = args.pop(0) | 466 keyfile = args.pop(0) |
470 # if the user has specified different key/cert files in | 470 # if the user has specified different key/cert files in |
471 # hgrc, we prefer these | 471 # hgrc, we prefer these |
472 if self.auth and 'key' in self.auth and 'cert' in self.auth: | 472 if self.auth and 'key' in self.auth and 'cert' in self.auth: |
473 keyfile = self.auth['key'] | 473 keyfile = self.auth['key'] |
474 certfile = self.auth['cert'] | 474 certfile = self.auth['cert'] |
475 | |
476 # let host port take precedence | |
477 if ':' in host and '[' not in host or ']:' in host: | |
478 host, port = host.rsplit(':', 1) | |
479 port = int(port) | |
480 if '[' in host: | |
481 host = host[1:-1] | |
482 | 475 |
483 return httpsconnection(host, port, keyfile, certfile, *args, **kwargs) | 476 return httpsconnection(host, port, keyfile, certfile, *args, **kwargs) |
484 | 477 |
485 # In python < 2.5 AbstractDigestAuthHandler raises a ValueError if | 478 # In python < 2.5 AbstractDigestAuthHandler raises a ValueError if |
486 # it doesn't know about the auth type requested. This can happen if | 479 # it doesn't know about the auth type requested. This can happen if |