Closed Bug 967792 Opened 10 years ago Closed 9 years ago

Firefox unable to connect to WebSocket on localhost

Categories

(Core :: Networking, defect)

26 Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla39
Tracking Status
firefox39 --- fixed

People

(Reporter: randall.h.wood, Assigned: mcmanus)

References

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:26.0) Gecko/20100101 Firefox/26.0 (Beta/Release)
Build ID: 20131205075310

Steps to reproduce:

I have an application, JMRI (http://jmri.org), running on OS X 10.9. This application supports both HTTP and WebSockets clients on port 12080. I am running this application on the same host as the Firefox 26.0 client.


Actual results:

Firefox successfully makes HTTP requests when connecting to http://localhost:12080 and http://127.0.0.1:12080 without issue, but can only establish WebSocket connections to ws://127.0.0.1:12080; attempts to connect to ws://localhost:12080 fail.
Safari on the same computer successfully connects to ws://localhost:12080 and ws://127.0.0.1:12080 without issue.


Expected results:

I expected that Firefox would be able to establish the WebSocket connection to both localhost and 127.0.0.1 without issue.
map localhost to 127.0.0.1 only in offline mode

Hello Patrick,
Could I have your review? 
Thanks.
Assignee: nobody → juhsu
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attachment #8564881 - Flags: review?(mcmanus)
Attachment #8564881 - Flags: review?(mcmanus)
Attachment #8565018 - Flags: review?(dd.mozilla)
Assignee: juhsu → mcmanus
Status: NEW → ASSIGNED
The patch makes the resolution of localhost while offline preffable - with a default to true (i.e. yes - resolve). The reason I made it preffable was some tests were explicitly testing offline result codes and we require the test infrastructure to use localhost - so they need to be accommodated.
Comment on attachment 8565018 [details] [diff] [review]
make localhost resolve offline

Review of attachment 8565018 [details] [diff] [review]:
-----------------------------------------------------------------

looks good.
Attachment #8565018 - Flags: review?(dd.mozilla) → review+
sorry had to back this out since i think this caused frequent OS X Test failures like https://treeherder.mozilla.org/logviewer.html#?job_id=6670898&repo=mozilla-inbound
Flags: needinfo?(mcmanus)
services/sync/tests/unit/test_errorhandler_sync_checkServerError.js needed  Services.prefs.setBoolPref("network.dns.offline-localhost", false) as the test actively probes offline behavior.
Flags: needinfo?(mcmanus)
Junior- you'll need to debug that gaia pinyin test if you want to land this.. thanks!
Assignee: mcmanus → juhsu
Component: Networking: WebSockets → Networking
Nevermind, it wasn't yours after all (sorry). I've got it queued to re-land once I sort out what actually was at fault.
Assignee: juhsu → nobody
https://hg.mozilla.org/mozilla-central/rev/c49df0e00b59
Assignee: nobody → mcmanus
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: