path: root/src
diff options
authorThomas McGuire <>2013-04-23 09:37:29 +0200
committerThe Qt Project <>2013-04-23 21:02:50 +0200
commite0cf3fcd8f8680e9c8b0fe1f1f18c1dda89eca80 (patch)
treea97bed01f0d41ab5a2b74e38fce5b8e63f6272dc /src
parent1ea1abeb91f544b4cf595d229249ee859090bee5 (diff)
Fix retrieving of the generic system proxy via environment variables
ignoreProxyFor() always returned true if the no_proxy was not set, which resulted in the first token being an empty QByteArray, causing the endsWith() check to always evaluate to true. Add a unit test that is enabled for those platforms that use the generic system proxy. Change-Id: I6081ad5e0b8e2c3fee1568835907c32bde5b7772 Reviewed-by: Peter Hartmann <>
Diffstat (limited to 'src')
1 files changed, 5 insertions, 1 deletions
diff --git a/src/network/kernel/qnetworkproxy_generic.cpp b/src/network/kernel/qnetworkproxy_generic.cpp
index 9069755da4..c576719076 100644
--- a/src/network/kernel/qnetworkproxy_generic.cpp
+++ b/src/network/kernel/qnetworkproxy_generic.cpp
@@ -55,7 +55,11 @@ QT_BEGIN_NAMESPACE
static bool ignoreProxyFor(const QNetworkProxyQuery &query)
- const QList<QByteArray> noProxyTokens = qgetenv("no_proxy").split(',');
+ const QByteArray noProxy = qgetenv("no_proxy").trimmed();
+ if (noProxy.isEmpty())
+ return false;
+ const QList<QByteArray> noProxyTokens = noProxy.split(',');
foreach (const QByteArray &rawToken, noProxyTokens) {
QByteArray token = rawToken.trimmed();