##// END OF EJS Templates
Allow http://user@example.com URLs (i.e. without passwords)
Alexis S. L. Carvalho -
r2556:f1ebc431 default
parent child Browse files
Show More
@@ -20,15 +20,21 b' class passwordmgr(urllib2.HTTPPasswordMg'
20 def find_user_password(self, realm, authuri):
20 def find_user_password(self, realm, authuri):
21 authinfo = urllib2.HTTPPasswordMgrWithDefaultRealm.find_user_password(
21 authinfo = urllib2.HTTPPasswordMgrWithDefaultRealm.find_user_password(
22 self, realm, authuri)
22 self, realm, authuri)
23 if authinfo != (None, None):
23 user, passwd = authinfo
24 return authinfo
24 if user and passwd:
25 return (user, passwd)
25
26
26 if not self.ui.interactive:
27 if not self.ui.interactive:
27 raise util.Abort(_('http authorization required'))
28 raise util.Abort(_('http authorization required'))
28
29
29 self.ui.write(_("http authorization required\n"))
30 self.ui.write(_("http authorization required\n"))
30 self.ui.status(_("realm: %s\n") % realm)
31 self.ui.status(_("realm: %s\n") % realm)
32 if user:
33 self.ui.status(_("user: %s\n") % user)
34 else:
31 user = self.ui.prompt(_("user:"), default=None)
35 user = self.ui.prompt(_("user:"), default=None)
36
37 if not passwd:
32 passwd = self.ui.getpass()
38 passwd = self.ui.getpass()
33
39
34 self.add_password(realm, authuri, user, passwd)
40 self.add_password(realm, authuri, user, passwd)
@@ -148,8 +154,8 b' class httprepository(remoterepository):'
148
154
149 passmgr = passwordmgr(ui)
155 passmgr = passwordmgr(ui)
150 if user:
156 if user:
151 ui.debug(_('will use user %s, password %s for http auth\n') %
157 ui.debug(_('http auth: user %s, password %s\n') %
152 (user, '*' * len(passwd)))
158 (user, passwd and '*' * len(passwd) or 'not set'))
153 passmgr.add_password(None, host, user, passwd or '')
159 passmgr.add_password(None, host, user, passwd or '')
154
160
155 opener = urllib2.build_opener(
161 opener = urllib2.build_opener(
General Comments 0
You need to be logged in to leave comments. Login now