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>
This commit is contained in:
Peter Hartmann 2014-06-23 13:50:49 +02:00
parent f46ce0a0b8
commit dfc1e23972

View File

@ -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);