summaryrefslogtreecommitdiffstats
path: root/src/network/kernel
diff options
context:
space:
mode:
authorShane Kearns <ext-shane.2.kearns@nokia.com>2012-02-22 21:20:46 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-03-09 16:15:35 (GMT)
commit1524b8dc5a994d01b51a5fa80b3e634e891b7e79 (patch)
tree6c5b8079421180aeb9676532a86f3a5993f06e1d /src/network/kernel
parentc48a8f307bf88244483443e72cb35c9b0ae187ff (diff)
downloadQt-1524b8dc5a994d01b51a5fa80b3e634e891b7e79.zip
Qt-1524b8dc5a994d01b51a5fa80b3e634e891b7e79.tar.gz
Qt-1524b8dc5a994d01b51a5fa80b3e634e891b7e79.tar.bz2
Windows - fall back on static proxy config if autoproxy fails
If both manual proxy settings are configured and the autodetect setting is enabled, fall back on the manual configuration when auto detection fails. Task-number: QTBUG-10428 Change-Id: If008c7c967eec6256ce3c614fff0ec258190d451 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Shane Kearns <shane.kearns@accenture.com> (cherry picked from commit 276f64d21d7b877044fddd646b855829950099b0)
Diffstat (limited to 'src/network/kernel')
-rw-r--r--src/network/kernel/qnetworkproxy_win.cpp40
1 files changed, 17 insertions, 23 deletions
diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp
index 9cfa42c..9fb37f6 100644
--- a/src/network/kernel/qnetworkproxy_win.cpp
+++ b/src/network/kernel/qnetworkproxy_win.cpp
@@ -313,14 +313,27 @@ void QWindowsSystemProxy::init()
proxyBypass = splitSpaceSemicolon(QString::fromWCharArray(ieProxyConfig.lpszProxyBypass));
GlobalFree(ieProxyConfig.lpszProxyBypass);
}
+ } else {
+ // no user configuration
+ // attempt to get the default configuration instead
+ WINHTTP_PROXY_INFO proxyInfo;
+ if (ptrWinHttpGetDefaultProxyConfiguration(&proxyInfo) &&
+ proxyInfo.dwAccessType == WINHTTP_ACCESS_TYPE_NAMED_PROXY) {
+ // we got information from the registry
+ // overwrite the IE configuration, if any
+
+ proxyBypass = splitSpaceSemicolon(QString::fromWCharArray(proxyInfo.lpszProxyBypass));
+ proxyServerList = splitSpaceSemicolon(QString::fromWCharArray(proxyInfo.lpszProxy));
+ }
+
+ if (proxyInfo.lpszProxy)
+ GlobalFree(proxyInfo.lpszProxy);
+ if (proxyInfo.lpszProxyBypass)
+ GlobalFree(proxyInfo.lpszProxyBypass);
}
hHttpSession = NULL;
if (ieProxyConfig.fAutoDetect || !autoConfigUrl.isEmpty()) {
- // using proxy autoconfiguration
- proxyServerList.clear();
- proxyBypass.clear();
-
// open the handle and obtain the options
hHttpSession = ptrWinHttpOpen(L"Qt System Proxy access/1.0",
WINHTTP_ACCESS_TYPE_NO_PROXY,
@@ -341,23 +354,6 @@ void QWindowsSystemProxy::init()
autoProxyOptions.dwFlags = WINHTTP_AUTOPROXY_CONFIG_URL;
autoProxyOptions.lpszAutoConfigUrl = (LPCWSTR)autoConfigUrl.utf16();
}
- } else {
- // not auto-detected
- // attempt to get the static configuration instead
- WINHTTP_PROXY_INFO proxyInfo;
- if (ptrWinHttpGetDefaultProxyConfiguration(&proxyInfo) &&
- proxyInfo.dwAccessType == WINHTTP_ACCESS_TYPE_NAMED_PROXY) {
- // we got information from the registry
- // overwrite the IE configuration, if any
-
- proxyBypass = splitSpaceSemicolon(QString::fromWCharArray(proxyInfo.lpszProxyBypass));
- proxyServerList = splitSpaceSemicolon(QString::fromWCharArray(proxyInfo.lpszProxy));
- }
-
- if (proxyInfo.lpszProxy)
- GlobalFree(proxyInfo.lpszProxy);
- if (proxyInfo.lpszProxyBypass)
- GlobalFree(proxyInfo.lpszProxyBypass);
}
functional = isAutoConfig || !proxyServerList.isEmpty();
@@ -431,8 +427,6 @@ QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro
//Don't search for it next time again.
sp->isAutoConfig = false;
}
-
- return sp->defaultResult;
}
// static configuration