Open Bug 1733755 Opened 3 years ago Updated 2 years ago

413 status code ignored when using XMLHttpRequest

Categories

(Core :: DOM: Networking, defect, P3)

Firefox 92
defect

Tracking

()

UNCONFIRMED

People

(Reporter: ericswpark, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:92.0) Gecko/20100101 Firefox/92.0

Steps to reproduce:

Use XMLHttpRequest to upload a FormData object containing large file (about 1~2GB) to a misconfigured server (such as nginx with client_max_body_size set too low) OR to a server proxied by a CDN that restricts large uploads, such as CloudFlare (POST requests restricted to 10MB or less).

Actual results:

XHR's onerror callback is called, but no error is filed under the console and the network request in the network request tab never shows a status code response from the server (return is always blank). The status code returned to XHR is 0.

Expected results:

The 413 error should be shown in the network request tab and should be returned to XHR so that the error can be displayed properly to the user/developer.

The Bugbug bot thinks this bug should belong to the 'DevTools::Netmonitor' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Netmonitor
Product: Firefox → DevTools
Component: Netmonitor → DOM: Networking
Product: DevTools → Core

I would like to know why we have this behavior, setting P2 to investigate.

Setting S4 because this is an old behavior.

Severity: -- → S4
Priority: -- → P2
Whiteboard: [necko-triaged]
Blocks: xhr
Priority: P2 → P3

I'm pretty sure this is the same bug. When the server terminates the connection prematurely, e.g. with a 413, Firefox returns all events as empty fields (status = 0, statusText = "", response = "", ...).

readyState: 4
​​response: ""
​​responseText: ""
​​responseType: ""
​​responseURL: ""
​​responseXML: null
​​status: 0
​​statusText: ""

Here's a reproducible example (including the server in Go; run as go run file.go): https://gist.github.com/binwiederhier/627f146d1959799be207ad8c17a8f345

You need to log in before you can comment on or make changes to this bug.