summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorAdrien Bustany <adrien.bustany@nokia.com>2012-04-25 11:23:01 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-16 10:06:16 (GMT)
commit7430d3f321b34a8a11470c55a2af1872a806726e (patch)
tree9232aa361441d7e657882c73642d3c664c64719d /src/network
parentbf8b674d95324f21551e6a221f6ec094e22da1a5 (diff)
downloadQt-7430d3f321b34a8a11470c55a2af1872a806726e.zip
Qt-7430d3f321b34a8a11470c55a2af1872a806726e.tar.gz
Qt-7430d3f321b34a8a11470c55a2af1872a806726e.tar.bz2
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 (cherry-picked from qtbase commit a7d1b6419d7503474ed5e02f7fb984e4ad5f9219) Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'src/network')
-rw-r--r--src/network/kernel/qnetworkproxy_generic.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/network/kernel/qnetworkproxy_generic.cpp b/src/network/kernel/qnetworkproxy_generic.cpp
index 485f745..d6681b0 100644
--- a/src/network/kernel/qnetworkproxy_generic.cpp
+++ b/src/network/kernel/qnetworkproxy_generic.cpp
@@ -53,11 +53,26 @@
QT_BEGIN_NAMESPACE
-QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &)
+QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &query)
{
QList<QNetworkProxy> proxyList;
- QByteArray proxy_env = qgetenv("http_proxy");
+ const QString queryProtocol = query.protocolTag().toLower();
+ 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")) {