##// END OF EJS Templates
url: do not continue HTTP authentication with user=None (issue6425)...
Yuya Nishihara -
r46381:ff48eea4 stable
parent child Browse files
Show More
@@ -96,6 +96,13 b' class passwordmgr(object):'
96 if not passwd:
96 if not passwd:
97 passwd = self.ui.getpass()
97 passwd = self.ui.getpass()
98
98
99 # As of Python 3.8, the default implementation of
100 # AbstractBasicAuthHandler.retry_http_basic_auth() assumes the user
101 # is set if pw is not None. This means (None, str) is not a valid
102 # return type of find_user_password().
103 if user is None:
104 return None, None
105
99 self.passwddb.add_password(realm, authuri, user, passwd)
106 self.passwddb.add_password(realm, authuri, user, passwd)
100 self._writedebug(user, passwd)
107 self._writedebug(user, passwd)
101 return (pycompat.strurl(user), pycompat.strurl(passwd))
108 return (pycompat.strurl(user), pycompat.strurl(passwd))
@@ -192,6 +192,34 b' test http authentication'
192 $ hg id http://localhost:$HGPORT2/
192 $ hg id http://localhost:$HGPORT2/
193 abort: http authorization required for http://localhost:$HGPORT2/
193 abort: http authorization required for http://localhost:$HGPORT2/
194 [255]
194 [255]
195 $ hg id --config ui.interactive=true --debug http://localhost:$HGPORT2/
196 using http://localhost:$HGPORT2/
197 sending capabilities command
198 http authorization required for http://localhost:$HGPORT2/
199 realm: mercurial
200 user: abort: response expected
201 [255]
202 $ cat <<'EOF' | hg id --config ui.interactive=true --config ui.nontty=true --debug http://localhost:$HGPORT2/
203 >
204 > EOF
205 using http://localhost:$HGPORT2/
206 sending capabilities command
207 http authorization required for http://localhost:$HGPORT2/
208 realm: mercurial
209 user:
210 password: abort: response expected
211 [255]
212 $ cat <<'EOF' | hg id --config ui.interactive=true --config ui.nontty=true --debug http://localhost:$HGPORT2/
213 >
214 >
215 > EOF
216 using http://localhost:$HGPORT2/
217 sending capabilities command
218 http authorization required for http://localhost:$HGPORT2/
219 realm: mercurial
220 user:
221 password: abort: authorization failed
222 [255]
195 $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/
223 $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/
196 http authorization required for http://localhost:$HGPORT2/
224 http authorization required for http://localhost:$HGPORT2/
197 realm: mercurial
225 realm: mercurial
@@ -360,6 +388,9 b' test http authentication'
360 "GET /?cmd=capabilities HTTP/1.1" 401 -
388 "GET /?cmd=capabilities HTTP/1.1" 401 -
361 "GET /?cmd=capabilities HTTP/1.1" 401 -
389 "GET /?cmd=capabilities HTTP/1.1" 401 -
362 "GET /?cmd=capabilities HTTP/1.1" 401 -
390 "GET /?cmd=capabilities HTTP/1.1" 401 -
391 "GET /?cmd=capabilities HTTP/1.1" 401 -
392 "GET /?cmd=capabilities HTTP/1.1" 401 -
393 "GET /?cmd=capabilities HTTP/1.1" 401 -
363 "GET /?cmd=capabilities HTTP/1.1" 200 -
394 "GET /?cmd=capabilities HTTP/1.1" 200 -
364 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
395 "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
365 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
396 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
General Comments 0
You need to be logged in to leave comments. Login now