##// END OF EJS Templates
httprepo: make "http://user:pass@host/" urls work
Vadim Gelfer -
r2447:cd00531e default
parent child Browse files
Show More
@@ -12,13 +12,13 b' from demandload import *'
12 demandload(globals(), "hg os urllib urllib2 urlparse zlib util httplib")
12 demandload(globals(), "hg os urllib urllib2 urlparse zlib util httplib")
13 demandload(globals(), "keepalive")
13 demandload(globals(), "keepalive")
14
14
15 class passwordmgr(urllib2.HTTPPasswordMgr):
15 class passwordmgr(urllib2.HTTPPasswordMgrWithDefaultRealm):
16 def __init__(self, ui):
16 def __init__(self, ui):
17 urllib2.HTTPPasswordMgr.__init__(self)
17 urllib2.HTTPPasswordMgrWithDefaultRealm.__init__(self)
18 self.ui = ui
18 self.ui = ui
19
19
20 def find_user_password(self, realm, authuri):
20 def find_user_password(self, realm, authuri):
21 authinfo = urllib2.HTTPPasswordMgr.find_user_password(
21 authinfo = urllib2.HTTPPasswordMgrWithDefaultRealm.find_user_password(
22 self, realm, authuri)
22 self, realm, authuri)
23 if authinfo != (None, None):
23 if authinfo != (None, None):
24 return authinfo
24 return authinfo
@@ -133,7 +133,8 b' class httprepository(remoterepository):'
133
133
134 passmgr = passwordmgr(ui)
134 passmgr = passwordmgr(ui)
135 if user:
135 if user:
136 ui.debug(_('will use user %s for http auth\n') % user)
136 ui.debug(_('will use user %s, password %s for http auth\n') %
137 (user, '*' * len(passwd)))
137 passmgr.add_password(None, host, user, passwd or '')
138 passmgr.add_password(None, host, user, passwd or '')
138
139
139 opener = urllib2.build_opener(
140 opener = urllib2.build_opener(
General Comments 0
You need to be logged in to leave comments. Login now