equal
deleted
inserted
replaced
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 |