summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Hartmann <phartmann@blackberry.com>2014-06-23 13:50:49 +0200
committerPeter Hartmann <phartmann@blackberry.com>2014-06-23 21:44:39 +0200
commitdfc1e23972136e8d86c45d43f3bf9048aa02c59a (patch)
tree7bd7eb92414ce3c59d6b65c551d4a6e580393fbf
parentf46ce0a0b819b74c4f25b5d9fcbb8a83b62dd417 (diff)
Mac networking: only try system proxy credentials once
... instead of running into an endless loop in case they are wrong. Task-number: QTBUG-30434 Change-Id: Iab258ebe1098a0c95f19da789a7a86de9d5bf149 Reviewed-by: Richard J. Moore <rich@kde.org>
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index e669712147..cc61f27cfb 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -1427,10 +1427,15 @@ void QNetworkAccessManagerPrivate::proxyAuthenticationRequired(const QUrl &url,
QString username;
QString password;
if (getProxyAuth(proxy.hostName(), url.scheme(), username, password)) {
- authenticator->setUser(username);
- authenticator->setPassword(password);
- authenticationManager->cacheProxyCredentials(proxy, authenticator);
- return;
+ // only cache the system credentials if they are correct (or if they have changed)
+ // to not run into an endless loop in case they are wrong
+ QNetworkAuthenticationCredential cred = authenticationManager->fetchCachedProxyCredentials(proxy);
+ if (!priv->hasFailed || cred.user != username || cred.password != password) {
+ authenticator->setUser(username);
+ authenticator->setPassword(password);
+ authenticationManager->cacheProxyCredentials(proxy, authenticator);
+ return;
+ }
}
#else
Q_UNUSED(url);