summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorEl Mehdi Fekari <mfekari@rim.com>2013-06-13 16:27:57 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-24 10:36:01 +0200
commit797864f3fded3dde91f9ca323d54ccc9511e70c5 (patch)
treef43f67a4e3d8175d9744250ce25444c1098e0967 /src/network
parenta8a8afe5adc583eab4edca8c79d8eb7fca2e24ec (diff)
QNetwork: Check AuthenticationReuseAttribute when using credentials from url
Note: This is not needed in Qt5, as the authenticationRequired method in Qt5 has an allowAuthenticationReuse parameter (bool) that is checked before the credentials are used. Change-Id: I5a2734de615a1a96d1fe648bd251850f3b45e167 Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
Diffstat (limited to 'src/network')
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index 17171d468b..4909bfdb43 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -1080,8 +1080,10 @@ 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
// also called when last URL is empty, e.g. on first call
- if (backend->reply->urlForLastAuthentication.isEmpty()
- || url != backend->reply->urlForLastAuthentication) {
+ if ((static_cast<QNetworkRequest::LoadControl>
+ (backend->request().attribute(QNetworkRequest::AuthenticationReuseAttribute).toInt()) != QNetworkRequest::Manual)
+ && (backend->reply->urlForLastAuthentication.isEmpty()
+ || url != backend->reply->urlForLastAuthentication)) {
// if credentials are included in the url, then use them
if (!url.userName().isEmpty()
&& !url.password().isEmpty()) {