Public bug reported:

def check_proxy_enabled(host, port):
    """Check if the proxy is enabled."""
    port = int(port)
    if sys.platform.startswith("linux"):
        settings = gsettings.get_proxy_settings()
        enabled = len(settings) > 0
        if enabled:
            proxy = build_proxy(settings)
            QNetworkProxy.setApplicationProxy(proxy)
        else:
            logger.info("Proxy is disabled.")
        return enabled
    else:
        QNetworkProxyFactory.setUseSystemConfiguration(True)
        query = QNetworkProxyQuery(host, port)
        proxies = QNetworkProxyFactory.systemProxyForQuery(query)
        # This is wrong ------------------------------------.
        return len(proxies) and proxies[0].type() != QNetworkProxy.DefaultProxy

When proxy is not enabled:
>>> from PyQt4.QtNetwork import (QNetworkProxyFactory, QNetworkProxyQuery, 
>>> QNetworkProxy)
>>> QNetworkProxyFactory.setUseSystemConfiguration(True)
>>> query = QNetworkProxyQuery("fs-1.one.ubuntu.com", 443)
>>> proxies = QNetworkProxyFactory.systemProxyForQuery(query)
>>> proxies
[<PyQt4.QtNetwork.QNetworkProxy object at 0x15e4d00>]
>>> proxies[0]
<PyQt4.QtNetwork.QNetworkProxy object at 0x15e4d00>
>>> proxies[0].type()
2

Where 2 = QNetworkProxy.NoProxy

Checked on Ubuntu and Windows

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: ubuntuone-client 3.0.0-0ubuntu1
ProcVersionSignature: Ubuntu 3.2.0-23.36-generic 3.2.14
Uname: Linux 3.2.0-23-generic x86_64
ApportVersion: 2.0.1-0ubuntu4
Architecture: amd64
Date: Thu Apr 19 14:15:36 2012
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Alpha amd64 (20120225)
PackageArchitecture: all
SourcePackage: ubuntuone-client
UbuntuOneSyncdaemonExceptionsLog:

UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: ubuntuone-client
     Importance: Undecided
     Assignee: Manuel de la Peña (mandel)
         Status: New

** Affects: ubuntuone-client (Ubuntu)
     Importance: Undecided
     Assignee: Manuel de la Peña (mandel)
         Status: New


** Tags: amd64 apport-bug precise

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/985576

Title:
  Proxy started when not needed

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntuone-client/+bug/985576/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to