Closed Bug 1944985 Opened 7 months ago Closed 7 months ago

Gitlab error page is overridden by Firefox internal error on 404 when `browser.http.blank_page_with_error_response.enabled false`

Categories

(Core :: Networking, defect, P2)

defect

Tracking

()

RESOLVED FIXED
137 Branch
Tracking Status
firefox137 --- fixed

People

(Reporter: manuel, Assigned: sekim)

References

Details

(Whiteboard: [necko-triaged][necko-priority-queue])

Attachments

(1 file)

Precondition: disable browser.http.blank_page_with_error_response.enabled by setting it to false
Example link: https://gitlab.com/gitlab-org/gitlab/-/issues/10000000000

Gitlab response:

HTTP/2 404 
server: nginx
date: Thu, 30 Jan 2025 22:59:38 GMT
content-type: text/html; charset=utf-8
cache-control: no-cache
content-security-policy: 
permissions-policy: interest-cohort=()
referrer-policy: strict-origin-when-cross-origin
vary: Accept
x-content-type-options: nosniff
x-download-options: noopen
x-frame-options: SAMEORIGIN
x-gitlab-custom-error: 1
x-gitlab-meta: {"correlation_id":"01JJWQ1ZXWBRKFZQMBJ32DYFEB","version":"1"}
x-permitted-cross-domain-policies: none
x-request-id: 01JJWQ1ZXWBRKFZQMBJ32DYFEB
x-runtime: 0.086389
x-ua-compatible: IE=edge
x-xss-protection: 1; mode=block

<!DOCTYPE html>
[...]
Severity: -- → S4
Priority: -- → P2
Whiteboard: [necko-triaged][necko-priority-next]

"No content-length" should not be treated as "content-length: 0" because the former will actually have content.

Here:
https://searchfox.org/mozilla-central/rev/548b6981501f59e3c9f2f7851c013e7d53c4e72f/uriloader/base/nsURILoader.cpp#139-140,142

if (NS_FAILED(rv) || contentLength <= 0) {

should be

if (NS_SUCCEEDED(rv) && contentLength <= 0) {

Of course we should consider the case where the response is empty and has no "content-length" header field.

Blocks: 1944358

(In reply to Masatoshi Kimura [:emk] from comment #1)

"No content-length" should not be treated as "content-length: 0" because the former will actually have content.

Right, based on debugging, I think we are getting contentLength of -1 (no content-length) for this GitLab page.
I think we can fix this by changing it to if (NS_SUCCEEDED(rv) && contentLength == 0) {

Assignee: nobody → sekim
Whiteboard: [necko-triaged][necko-priority-next] → [necko-triaged][necko-priority-queue]
See Also: → 1945855
Pushed by sekim@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7dc8b9c186f3 Avoid treating responses without a Content-Length header as having Content-Length of 0 r=manuel,necko-reviewers,kershaw DONTBUILD
Status: NEW → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 137 Branch

(In reply to Pulsebot from comment #5)

Pushed by sekim@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7dc8b9c186f3
Avoid treating responses without a Content-Length header as having
Content-Length of 0 r=manuel,necko-reviewers,kershaw DONTBUILD

Note: The DONTBUILD flag was removed afterwards.

See Also: → 1956000
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: