diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2010-10-19 14:01:01 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2010-10-27 12:40:26 (GMT) |
commit | d18292563cc6bfee3876b830420b1f29c0a6c260 (patch) | |
tree | bc8cc6451b628e4faf1cef2a071fd242dc1d12c3 /src/network/access/qnetworkaccessmanager.cpp | |
parent | 4c29a590cbdd68006906cb8ce3250f8d19caa3d6 (diff) | |
download | Qt-d18292563cc6bfee3876b830420b1f29c0a6c260.zip Qt-d18292563cc6bfee3876b830420b1f29c0a6c260.tar.gz Qt-d18292563cc6bfee3876b830420b1f29c0a6c260.tar.bz2 |
QNAM: Do not load credentials from cache prematurely
The credentials shall only be loaded on demand, e.g. after the HTTP
code emits authenticationRequired()
Reviewed-by: Prasanth
Task-Number: QTBUG-13234
Diffstat (limited to 'src/network/access/qnetworkaccessmanager.cpp')
-rw-r--r-- | src/network/access/qnetworkaccessmanager.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 12fe094..0d33a46 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1025,16 +1025,8 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera priv->manager = this; // second step: fetch cached credentials - if (static_cast<QNetworkRequest::LoadControl> - (request.attribute(QNetworkRequest::AuthenticationReuseAttribute, - QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Automatic) { - QNetworkAuthenticationCredential *cred = d->fetchCachedCredentials(url); - if (cred) { - url.setUserName(cred->user); - url.setPassword(cred->password); - priv->urlForLastAuthentication = url; - } - } + // This is not done for the time being, we should use signal emissions to request + // the credentials from cache. // third step: find a backend priv->backend = d->findBackend(op, request); @@ -1116,7 +1108,9 @@ void QNetworkAccessManagerPrivate::authenticationRequired(QNetworkAccessBackend // don't try the cache for the same URL twice in a row // being called twice for the same URL means the authentication failed - if (url != backend->reply->urlForLastAuthentication) { + // also called when last URL is empty, e.g. on first call + if (backend->reply->urlForLastAuthentication.isEmpty() + || url != backend->reply->urlForLastAuthentication) { QNetworkAuthenticationCredential *cred = fetchCachedCredentials(url, authenticator); if (cred) { authenticator->setUser(cred->user); |