From dfc1e23972136e8d86c45d43f3bf9048aa02c59a Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Mon, 23 Jun 2014 13:50:49 +0200 Subject: 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 --- src/network/access/qnetworkaccessmanager.cpp | 13 +++++++++---- 1 file 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); -- cgit v1.2.3