summaryrefslogtreecommitdiffstats
path: root/src/network/access/qnetworkaccessmanager.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-10-29 08:59:32 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-10-29 08:59:32 (GMT)
commitc02ef9eb331f03dbd59d2fd938c53b54f5c65cea (patch)
tree93defa0a21c2ecc1261c5d549087916a69cb4f55 /src/network/access/qnetworkaccessmanager.cpp
parent60d37c9c2f99ee1b10293c4dbc0264664dd8cad0 (diff)
parent60948c48adc376cefa774bd101de34c60db52dea (diff)
downloadQt-c02ef9eb331f03dbd59d2fd938c53b54f5c65cea.zip
Qt-c02ef9eb331f03dbd59d2fd938c53b54f5c65cea.tar.gz
Qt-c02ef9eb331f03dbd59d2fd938c53b54f5c65cea.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (25 commits) QNAM: Fix doc rendering of QNetworkRequest remove the connecting thread, and use async call to dbus instead. QScriptValue::construct(): Don't crash if function throws non-Object Network code: Fix code comment spellchecking errors. QNAM: fix build QNAM HTTP: Remove the error() of QHttpNetworkConnection QNAM HTTP: Remove enableEncryption() QNAM HTTP: Remove unused code QNAM HTTP: Move authenticationRequired() to QHttpNetworkReply QNAM HTTP: Move proxyAuthenticationRequired() to QHttpNetworkReply QNAM HTTP: Move cacheCredentials() to QHttpNetworkReply QNAM HTTP: Use sslErrors() from QHttpNetworkReply QNAM HTTP: Remove Wait4AuthState QNAM: Internal function renaming QNAM HTTP: Internal variable spelling mistakes QNAM HTTP: Pause connection when emitting proxy auth signal QNAM HTTP: Also pause connection when emitting sslErrors() QNAM HTTP: Also resume uploads after connection pause QNAM HTTP: Process authenticationRequired() from HTTP properly QNAM HTTP: Pause sockets while emitting to user code. ...
Diffstat (limited to 'src/network/access/qnetworkaccessmanager.cpp')
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index 12fe094..e5f4d5a 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);
@@ -1128,7 +1122,7 @@ void QNetworkAccessManagerPrivate::authenticationRequired(QNetworkAccessBackend
backend->reply->urlForLastAuthentication = url;
emit q->authenticationRequired(backend->reply->q_func(), authenticator);
- addCredentials(url, authenticator);
+ cacheCredentials(url, authenticator);
}
#ifndef QT_NO_NETWORKPROXY
@@ -1145,7 +1139,7 @@ void QNetworkAccessManagerPrivate::proxyAuthenticationRequired(QNetworkAccessBac
// possible solution: some tracking inside the authenticator
// or a new function proxyAuthenticationSucceeded(true|false)
if (proxy != backend->reply->lastProxyAuthentication) {
- QNetworkAuthenticationCredential *cred = fetchCachedCredentials(proxy);
+ QNetworkAuthenticationCredential *cred = fetchCachedProxyCredentials(proxy);
if (cred) {
authenticator->setUser(cred->user);
authenticator->setPassword(cred->password);
@@ -1155,10 +1149,10 @@ void QNetworkAccessManagerPrivate::proxyAuthenticationRequired(QNetworkAccessBac
backend->reply->lastProxyAuthentication = proxy;
emit q->proxyAuthenticationRequired(proxy, authenticator);
- addCredentials(proxy, authenticator);
+ cacheProxyCredentials(proxy, authenticator);
}
-void QNetworkAccessManagerPrivate::addCredentials(const QNetworkProxy &p,
+void QNetworkAccessManagerPrivate::cacheProxyCredentials(const QNetworkProxy &p,
const QAuthenticator *authenticator)
{
Q_ASSERT(authenticator);
@@ -1195,7 +1189,7 @@ void QNetworkAccessManagerPrivate::addCredentials(const QNetworkProxy &p,
}
QNetworkAuthenticationCredential *
-QNetworkAccessManagerPrivate::fetchCachedCredentials(const QNetworkProxy &p,
+QNetworkAccessManagerPrivate::fetchCachedProxyCredentials(const QNetworkProxy &p,
const QAuthenticator *authenticator)
{
QNetworkProxy proxy = p;
@@ -1247,7 +1241,7 @@ QList<QNetworkProxy> QNetworkAccessManagerPrivate::queryProxy(const QNetworkProx
}
#endif
-void QNetworkAccessManagerPrivate::addCredentials(const QUrl &url,
+void QNetworkAccessManagerPrivate::cacheCredentials(const QUrl &url,
const QAuthenticator *authenticator)
{
Q_ASSERT(authenticator);