Mercurial > hg
comparison mercurial/url.py @ 29378:fea71f66ebff
url: remember http password database in ui object
This makes http password database stored in ui object.
It allows reusing authentication information when we
use this database for creating password manager for
the new connection.
author | liscju <piotr.listkiewicz@gmail.com> |
---|---|
date | Thu, 09 Jun 2016 11:41:36 +0200 |
parents | 2c019aac6b99 |
children | fc777c855d66 |
comparison
equal
deleted
inserted
replaced
29377:2c019aac6b99 | 29378:fea71f66ebff |
---|---|
363 def __init__(self, ui): | 363 def __init__(self, ui): |
364 keepalive.KeepAliveHandler.__init__(self) | 364 keepalive.KeepAliveHandler.__init__(self) |
365 urlreq.httpshandler.__init__(self) | 365 urlreq.httpshandler.__init__(self) |
366 self.ui = ui | 366 self.ui = ui |
367 self.pwmgr = passwordmgr(self.ui, | 367 self.pwmgr = passwordmgr(self.ui, |
368 urlreq.httppasswordmgrwithdefaultrealm()) | 368 self.ui.httppasswordmgrdb) |
369 | 369 |
370 def _start_transaction(self, h, req): | 370 def _start_transaction(self, h, req): |
371 _generic_start_transaction(self, h, req) | 371 _generic_start_transaction(self, h, req) |
372 return keepalive.KeepAliveHandler._start_transaction(self, h, req) | 372 return keepalive.KeepAliveHandler._start_transaction(self, h, req) |
373 | 373 |
480 # experimental config: ui.usehttp2 | 480 # experimental config: ui.usehttp2 |
481 if ui.configbool('ui', 'usehttp2', False): | 481 if ui.configbool('ui', 'usehttp2', False): |
482 handlers = [ | 482 handlers = [ |
483 httpconnectionmod.http2handler( | 483 httpconnectionmod.http2handler( |
484 ui, | 484 ui, |
485 passwordmgr(ui, urlreq.httppasswordmgrwithdefaultrealm())) | 485 passwordmgr(ui, ui.httppasswordmgrdb)) |
486 ] | 486 ] |
487 else: | 487 else: |
488 handlers = [httphandler()] | 488 handlers = [httphandler()] |
489 if has_https: | 489 if has_https: |
490 handlers.append(httpshandler(ui)) | 490 handlers.append(httpshandler(ui)) |
491 | 491 |
492 handlers.append(proxyhandler(ui)) | 492 handlers.append(proxyhandler(ui)) |
493 | 493 |
494 passmgr = passwordmgr(ui, urlreq.httppasswordmgrwithdefaultrealm()) | 494 passmgr = passwordmgr(ui, ui.httppasswordmgrdb) |
495 if authinfo is not None: | 495 if authinfo is not None: |
496 passmgr.add_password(*authinfo) | 496 passmgr.add_password(*authinfo) |
497 user, passwd = authinfo[2:4] | 497 user, passwd = authinfo[2:4] |
498 ui.debug('http auth: user %s, password %s\n' % | 498 ui.debug('http auth: user %s, password %s\n' % |
499 (user, passwd and '*' * len(passwd) or 'not set')) | 499 (user, passwd and '*' * len(passwd) or 'not set')) |