Closed Bug 2087967 Opened 27 days ago Closed 27 days ago

Localhost connection-refused hints don't appear when the URL has a port

Categories

(Toolkit :: Error Pages, defect)

defect

Tracking

()

RESOLVED FIXED
161 Branch
Tracking Status
firefox-esr153 --- unaffected
firefox159 --- unaffected
firefox160 --- unaffected
firefox161 --- fixed

People

(Reporter: dekushrub519, Assigned: dekushrub519)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 external file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:159.0) Gecko/20100101 Firefox/159.0

Steps to reproduce

Bug 2079962 added developer-focused hints to the "Unable to connect" page when a
connection to a loopback address is refused. In practice they only appear for
URLs on the default port (e.g. http://localhost/), not for typical dev server
URLs such as http://127.0.0.1:5000/ (see bug 2079962 comment 4).

getLoopbackInfo() in toolkit/content/aboutNetErrorHelpers.mjs checks
document.location.host, which includes the port ("127.0.0.1:5000"), so the
localhost / 127.x / [::1] checks never match whenever a port is present. It
should use document.location.hostname.

The existing tests didn't catch this because they either pass a prebuilt
loopback context to getResolvedErrorConfig() or load an about:neterror URL
directly, so getLoopbackInfo() never ran against a real failed URL.

Steps to reproduce:

  1. Make sure nothing is listening on port 5000.
  2. Load http://127.0.0.1:5000/ (or http://localhost:5000/).

Actual results

Expected: "Nothing is accepting connections on port 5000. ..." hints.

Expected results

Actual: The generic "try again / check your network / firewall" hints.

Patch incoming, with a browser test that loads a real refused port.

Keywords: regression
Regressed by: 2079962

location.host includes the port, so the loopback check never matched URLs
with an explicit port, such as http://127.0.0.1:5000/, and the loopback hints
were only shown on default ports.

Add a browser test that loads a real refused port, so getLoopbackInfo() runs
against an actual failed URL.

Assignee: nobody → dekushrub519
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

Set release status flags based on info from the regressing bug 2079962

Pushed by gijskruitbosch@gmail.com: https://github.com/mozilla-firefox/firefox/commit/578f659bec47 https://hg.mozilla.org/integration/autoland/rev/5f03facab36f Use hostname rather than host when detecting loopback error pages. r=firefox-desktop-core-reviewers ,Gijs
Status: ASSIGNED → RESOLVED
Closed: 27 days ago
Resolution: --- → FIXED
Target Milestone: --- → 161 Branch
QA Whiteboard: [qa-triage-done-c162/b161]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: