##// END OF EJS Templates
url: added authuri when login information is requested (issue3209)...
Lucas Moscovicz -
r20291:7d589d92 default
parent child Browse files
Show More
@@ -32,10 +32,14 b' class passwordmgr(urllib2.HTTPPasswordMg'
32 user, passwd = auth.get('username'), auth.get('password')
32 user, passwd = auth.get('username'), auth.get('password')
33 self.ui.debug("using auth.%s.* for authentication\n" % group)
33 self.ui.debug("using auth.%s.* for authentication\n" % group)
34 if not user or not passwd:
34 if not user or not passwd:
35 u = util.url(authuri)
36 u.query = None
35 if not self.ui.interactive():
37 if not self.ui.interactive():
36 raise util.Abort(_('http authorization required'))
38 raise util.Abort(_('http authorization required for %s') %
39 util.hidepassword(str(u)))
37
40
38 self.ui.write(_("http authorization required\n"))
41 self.ui.write(_("http authorization required for %s\n") %
42 util.hidepassword(str(u)))
39 self.ui.write(_("realm: %s\n") % realm)
43 self.ui.write(_("realm: %s\n") % realm)
40 if user:
44 if user:
41 self.ui.write(_("user: %s\n") % user)
45 self.ui.write(_("user: %s\n") % user)
@@ -156,12 +156,24 b' test http authentication'
156 > --config server.preferuncompressed=True
156 > --config server.preferuncompressed=True
157 $ cat pid >> $DAEMON_PIDS
157 $ cat pid >> $DAEMON_PIDS
158
158
159 $ cat << EOF > get_pass.py
160 > import getpass
161 > def newgetpass(arg):
162 > return "pass"
163 > getpass.getpass = newgetpass
164 > EOF
165
159 $ hg id http://localhost:$HGPORT2/
166 $ hg id http://localhost:$HGPORT2/
160 abort: http authorization required
167 abort: http authorization required for http://localhost:$HGPORT2/
161 [255]
168 [255]
162 $ hg id http://user@localhost:$HGPORT2/
169 $ hg id http://localhost:$HGPORT2/
163 abort: http authorization required
170 abort: http authorization required for http://localhost:$HGPORT2/
164 [255]
171 [255]
172 $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/
173 http authorization required for http://localhost:$HGPORT2/
174 realm: mercurial
175 user: user
176 password: 5fed3813f7f5
165 $ hg id http://user:pass@localhost:$HGPORT2/
177 $ hg id http://user:pass@localhost:$HGPORT2/
166 5fed3813f7f5
178 5fed3813f7f5
167 $ echo '[auth]' >> .hg/hgrc
179 $ echo '[auth]' >> .hg/hgrc
@@ -183,7 +195,7 b' test http authentication'
183 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
195 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
184
196
185 $ hg id http://user2@localhost:$HGPORT2/
197 $ hg id http://user2@localhost:$HGPORT2/
186 abort: http authorization required
198 abort: http authorization required for http://localhost:$HGPORT2/
187 [255]
199 [255]
188 $ hg id http://user:pass2@localhost:$HGPORT2/
200 $ hg id http://user:pass2@localhost:$HGPORT2/
189 abort: HTTP Error 403: no
201 abort: HTTP Error 403: no
General Comments 0
You need to be logged in to leave comments. Login now