summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdrien Bustany <adrien.bustany@nokia.com>2012-04-25 14:23:01 +0300
committerQt by Nokia <qt-info@nokia.com>2012-05-05 03:51:03 +0200
commita7d1b6419d7503474ed5e02f7fb984e4ad5f9219 (patch)
treeca802c5b652ecb8c690d71193a9b90705fe53b2d /src
parent32adb82741b0a4851624b2e6b441b8d83fe6daf0 (diff)
QNetworkProxyFactory: check all the proxy environment variables
QNetworkProxyFactory used to check only for the http_proxy environment variable in systemProxyForQuery. This patch makes it look as well in https_proxy, ftp_proxy and all_proxy. http_proxy is still used as a fallback value. Change-Id: I7934af70d191cd17dbce3b3789260ae1a8332986 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'src')
-rw-r--r--src/network/kernel/qnetworkproxy_generic.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/network/kernel/qnetworkproxy_generic.cpp b/src/network/kernel/qnetworkproxy_generic.cpp
index 66053b0b47..61aedbe4fb 100644
--- a/src/network/kernel/qnetworkproxy_generic.cpp
+++ b/src/network/kernel/qnetworkproxy_generic.cpp
@@ -91,7 +91,23 @@ QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro
if (ignoreProxyFor(query))
return proxyList << QNetworkProxy::NoProxy;
- QByteArray proxy_env = qgetenv("http_proxy");
+ // No need to care about casing here, QUrl lowercases values already
+ const QString queryProtocol = query.protocolTag();
+ QByteArray proxy_env;
+
+ if (queryProtocol == QLatin1String("http"))
+ proxy_env = qgetenv("http_proxy");
+ else if (queryProtocol == QLatin1String("https"))
+ proxy_env = qgetenv("https_proxy");
+ else if (queryProtocol == QLatin1String("ftp"))
+ proxy_env = qgetenv("ftp_proxy");
+ else
+ proxy_env = qgetenv("all_proxy");
+
+ // Fallback to http_proxy is no protocol specific proxy was found
+ if (proxy_env.isEmpty())
+ proxy_env = qgetenv("http_proxy");
+
if (!proxy_env.isEmpty()) {
QUrl url = QUrl(QString::fromLocal8Bit(proxy_env));
if (url.scheme() == QLatin1String("socks5")) {