Closed Bug 1700857 Opened 3 years ago Closed 3 years ago

Firefox fails to connect to any website with SOCKS proxy if network is set to 'Use system proxy settings' on macOS

Categories

(Core :: Networking, defect, P2)

Firefox 88
defect

Tracking

()

VERIFIED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: nyhvec, Assigned: kershaw)

References

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

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

Steps to reproduce:

  1. Open https://www.websocket.org/echo.html
  2. Click 'Connect' button

Actual results:

It says
ERROR: undefined
DISCONNECTED

Expected results:

CONNECTED

macOS version: 11.3 Beta (20E5217a)
Firefox version: 88.0b2

I have set both SOCKS and HTTP proxy in system preferences.

Some tests:

  1. Use system settings + set http/https proxy in system preferences = Work
  2. Use system settings + set socks proxy in system preferences = Not Work
  3. Manually set proxy with http/https proxy = Work
  4. Manually set proxy with socks proxy = Work
  5. Manually set proxy with http/https proxy = Work
  6. Manually set proxy with both http/https proxy and socks proxy = Work

It seems not work only when Use system settings and set a SOCKS proxy in system.

Summary: WebSocket does not work if network is set to 'Use system proxy settings' on macOS → Firefox fails to connect to any website with SOCKS proxy if network is set to 'Use system proxy settings' on macOS

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 → General
Product: DevTools → Firefox

My SOCKS proxy only supports version 5. I notice Firefox sends a packet starting with 0x040101bb 00000001 ..... which indicates a SOCKS 4 handshake packet. However network.proxy.socks_version is set to 5 by default. Is this a bug or I missed something?

I compiled Firefox on my Mac and modified network/socket/nsSOCKSIOLayer.cpp line #373 to mVersion = 5; to force use SOCKSv5 and everything works fine now. So I think Firefox does not check SOCKS version and uses v4 by default when using system proxy...?

Component: General → Networking
Product: Firefox → Core
Severity: -- → S3
Priority: -- → P2
Whiteboard: [necko-triaged]

Could you check if the value of this pref network.proxy.socks_version is 5?
Thanks.

Flags: needinfo?(nyhvec)

Yes, it is 5.

Flags: needinfo?(nyhvec)

The problem is at this line. The system proxy setting only indicates to use SOCKS proxy without specifying the version, we chose version 4 for compatibility.
I'll add a new pref network.proxy.default_socks_version so that one could choose to use version 5.

Assignee: nobody → kershaw

We could also go with the other approach in bug 1424820 comment #12, but I think introducing another pref would be easier.

Pushed by kjang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c446ec523901
Add a pref to allow a user to use SOCKS5, r=necko-reviewers,valentin
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
Flags: qe-verify+

I can't seem to be able to reproduce this issue. Can you please verify the fix using latest beta? You can find the build
here.

Flags: needinfo?(nyhvec)

The new pref works as expected in 91.0b9 (64-bit).

  1. Set a SOCKS5 proxy in System Preferences
  2. Select Use system proxy settings in Firefox
  3. Set network.proxy.default_pac_script_socks_version to 4 = Not work
  4. Set network.proxy.default_pac_script_socks_version to 5 = Work
Flags: needinfo?(nyhvec)

Since I was not able to reproduce this issue on latest Beta_95.0b3(20211104185958) and based on comment 14. Closing as fixed.

Status: RESOLVED → VERIFIED

(In reply to Haonan Yu from comment #14)

The new pref works as expected in 91.0b9 (64-bit).

  1. Set a SOCKS5 proxy in System Preferences
  2. Select Use system proxy settings in Firefox
  3. Set network.proxy.default_pac_script_socks_version to 4 = Not work
  4. Set network.proxy.default_pac_script_socks_version to 5 = Work

network.proxy.default_pac_script_socks_version. It works for me. Thanks.

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

Attachment

General

Created:
Updated:
Size: