comparison tests/test-http.t @ 45759:ff48eea4a926 stable

url: do not continue HTTP authentication with user=None (issue6425) I initially thought this is a py3-compat bug of passwordmgr._writedebug(), but actually returning (None, str) pair is wrong at all. HTTP authentication would continue with user="None" in that case. Since registering a password of user=None should also be wrong, this patch simply adds early return.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 23 Oct 2020 20:33:36 +0900
parents edc8504bc26b
children ebee234d952a
comparison
equal deleted inserted replaced
45758:14ac6a74e7e7 45759:ff48eea4a926
189 $ hg id http://localhost:$HGPORT2/ 189 $ hg id http://localhost:$HGPORT2/
190 abort: http authorization required for http://localhost:$HGPORT2/ 190 abort: http authorization required for http://localhost:$HGPORT2/
191 [255] 191 [255]
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]
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
194 [255] 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
198 user: user 226 user: user
358 386
359 $ sed 's/.*] "/"/' < ../access.log 387 $ sed 's/.*] "/"/' < ../access.log
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
366 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull 397 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull
367 "GET /?cmd=capabilities HTTP/1.1" 401 - 398 "GET /?cmd=capabilities HTTP/1.1" 401 -