Open Bug 1973224 Opened 1 day ago Updated 1 day ago

Retrying failed http auth'd dialog twice retries it without auth again but claims to have succeeded

Categories

(Firefox :: Downloads Panel, defect, P2)

Firefox 141
Desktop
All
defect

Tracking

()

Tracking Status
firefox141 --- affected

People

(Reporter: Gijs, Unassigned)

References

(Depends on 1 open bug)

Details

Cloned/split from bug 1971011 - although passing the correct auth credentials will of course make things work (and we should fix that in bug 1971011), I think it is wrong that we treat the download as successful if we get a 401 or similar.


User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0

Steps to reproduce:

(Reduced from real case, repro using https://github.com/thecoshman/http; should generalise trivially.)
$ truncate -s 100G 100G
$ http --request-bandwidth 100000 --auth a:b
Hosting "." on port 8000 without TLS and basic authentication...
Requests limited to 100000B/s.
Basic authentication credentials:
Path Username Password
/ a b
Ctrl-C to stop.

Open http://localhost:8000 in firefox
[2025-06-07 20:12:35] 192.168.1.109:40305 requested to GET http://localhost:8000/ without authorisation
Log in as a:b
[2025-06-07 20:12:37] 192.168.1.109:40305 correctly authorised to GET http://localhost:8000/
[2025-06-07 20:12:37] 192.168.1.109:40305 was served directory listing for /home/nabijaczleweli/uwu
[2025-06-07 20:12:37] encoded as gzip for 365.8% ratio

Click 100G to download it
[2025-06-07 20:13:13] 192.168.1.109:40307 correctly authorised to GET http://localhost:8000/100G
[2025-06-07 20:13:13] 192.168.1.109:40307 was served file /home/nabijaczleweli/uwu/100G as application/octet-stream

Now ^C the server.
Firefox marks the download Failed.

$ http --request-bandwidth 100000 --auth a:b
Hosting "." on port 8000 without TLS and basic authentication...
Requests limited to 100000B/s.
Basic authentication credentials:
Path Username Password
/ a b
Ctrl-C to stop.

Click Retry download.
[2025-06-07 20:14:18] 192.168.1.109:40319 requested to GET http://localhost:8000/100G without authorisation

The download fails instantly.

Click Retry download.
[2025-06-07 20:14:39] 192.168.1.109:40325 requested to GET http://localhost:8000/100G without authorisation

The download /succeeds/ instantly!

$ cat ~/Downloads/100G
Credentials required.

Even though it failed (the server replies with 401 Unauthorized with "Credentials required." as the body).

Severity: -- → S2
Priority: -- → P2
You need to log in before you can comment on or make changes to this bug.