Firefox uses Socks proxy from Gnome network proxy

Bug #801346 reported by Dmitry Kasatkin on 2011-06-23
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mozilla Firefox
Won't Fix
Medium
firefox (Ubuntu)
Medium
Unassigned

Bug Description

1)

Description: Ubuntu 11.04
Release: 11.04

2)
firefox:
  Installed: 5.0+build1+nobinonly-0ubuntu0.11.04.2
  Candidate: 5.0+build1+nobinonly-0ubuntu0.11.04.2
  Version table:
 *** 5.0+build1+nobinonly-0ubuntu0.11.04.2 0
        500 http://fi.archive.ubuntu.com/ubuntu/ natty-updates/main i386 Packages
        500 http://security.ubuntu.com/ubuntu/ natty-security/main i386 Packages
        100 /var/lib/dpkg/status
     4.0+nobinonly-0ubuntu3 0
        500 http://fi.archive.ubuntu.com/ubuntu/ natty/main i386 Packages

3)
Gnome Network Proxy has different settings for HTTP/HTTPS and SOCKS proxies.
And Firefox proxy settings are set to use System proxy settings.

While browsing, Firefox must use HTTP/HTTPS proxy.

4)
Firefox actually uses SOCKS proxy, instead of HTTP/HTTPS.

NB... If using those proxy settings in Firefox itself, it uses HTTP/HTTPS...
I guess, it must use HTTP also from System settings as well...

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.5) Gecko/20091105 Fedora/3.5.5-1.fc11 Firefox/3.5.5
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.5) Gecko/20091105 Fedora/3.5.5-1.fc11 Firefox/3.5.5

In the case of using "system" proxy settings and /system/http_proxy/use_same_proxy is not set, the SOCKS proxy is used in preference to the HTTP or FTP proxy.

This behaviour is wrong because the protocol specific protocols are more specific. For example, if one wants to specify an HTTP proxy but fall back to a SOCKS proxy for other protocols.

The relevant code is in nsUnixSystemProxySettings::GetProxyFromGConf(). It would be better (and simpler) IMO to only set the type to SOCKS if there is no protocol specific proxy setting

Reproducible: Always

Steps to Reproduce:
1. On a network with a suitable http proxy <proxy host> Set system proxy settings (using Gconf Editor, or Network Proxy Preferences applet etc) to:

/system/http_proxy/host <proxy host>
/system/http_proxy/port <proxy port>
/system/http_proxy/use_http_proxy true
/system/http_proxy/use_same_proxy false
/system/proxy/socks_host <invalid hostname>

2. Try to connect to a well known public web site
Actual Results:
Connection fails.

Expected Results:
Connection should have succeeded

As far as I can see, the logic for handling manually set proxies in the preferences UI is the same as I am proposing for system preferences.

Created attachment 411217
Patch to fix System proxy Setting logic in unix type systems

Comment on attachment 411217
Patch to fix System proxy Setting logic in unix type systems

Is this patch for 3.5?

Looks like it, but it still has to go through the usual "land on trunk first, then on branches if approved" cycle. But what's more important is that this patch is apparently reversed - Michael, did you take that into account when you reviewed it?

Also, did you test this patch, Ian?
I don't know this code, but with your patch I'm not sure how the fallback to the SOCKS proxy can work when no specific protocol proxy is set. For example, when looking for a proxy for the http protocol, doesn't the control flow always take the first "if" branch and leave the whole if block after unsuccessfully trying to get an http proxy, without ever entering the SOCKS proxy "else" branch?

Whoops. Yes it is reversed, and yes you are right it doesn't cater for the case where there is no HTTP proxy, but there is a SOCKS proxy. I haven't got a socks proxy ;-(

I think the following fixes it though:

  rv = NS_ERROR_FAILURE;
  if (aScheme.LowerCaseEqualsLiteral("http") || useHttpProxyForAll) {
    rv = SetProxyResultFromGConf("/system/http_proxy/", "PROXY", aResult);
  } else if (aScheme.LowerCaseEqualsLiteral("https")) {
    rv = SetProxyResultFromGConf("/system/proxy/secure_", "PROXY", aResult);
  } else (aScheme.LowerCaseEqualsLiteral("ftp")) {
    rv = SetProxyResultFromGConf("/system/proxy/ftp_", "PROXY", aResult);
  }
  if (NS_FAILED(rv)) {
    rv = SetProxyResultFromGConf("/system/proxy/socks_", "SOCKS", aResult);
  }

Comment on attachment 411217
Patch to fix System proxy Setting logic in unix type systems

I only asked because it looked like, to me, these changes were already on trunk.

If it is wrong, then we need a new patch on mozilla-central

Ian, do you want to create a new patch for the mozilla-central repository?

https://developer.mozilla.org/En/Developer_Guide/Source_Code/Mercurial

Micah Gersten (micahg) wrote :

Thank you for your bug report. This bug has already been reported to the developers of the software. The upstream bug comments will soon be imported into Launchpad and you will be able to track the bug's progress. Please report any other issues you may find.

Changed in firefox (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Changed in firefox:
importance: Unknown → Medium
status: Unknown → Confirmed

On 06/24/2011 12:36 AM, Micah Gersten wrote:
> Thank you for your bug report. This bug has already been reported to the
> developers of the software. The upstream bug comments will soon be
> imported into Launchpad and you will be able to track the bug's
> progress. Please report any other issues you may find.
>
>
> ** Bug watch added: Mozilla Bugzilla #527478
> https://bugzilla.mozilla.org/show_bug.cgi?id=527478
>
> ** Also affects: firefox via
> https://bugzilla.mozilla.org/show_bug.cgi?id=527478
> Importance: Unknown
> Status: Unknown
>
> ** Changed in: firefox (Ubuntu)
> Importance: Undecided => Medium
>
> ** Changed in: firefox (Ubuntu)
> Status: New => Triaged
>
Thank You!

Changed in firefox:
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.