diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-09-24 09:49:07 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-09-24 12:04:52 +0200 |
commit | c96426f19f8c244c0f5748f0009016f576db9616 (patch) | |
tree | f6365344e8a24415e7a67694af2f0c043bb0dae6 /src/network | |
parent | 2137cb7dc5c902ce71855901c83c4c9d87b1ce2d (diff) | |
parent | c5a3e5edd9e63b18abf1838c86a27a662224b02c (diff) |
Merge "Merge remote-tracking branch 'origin/5.3' into 5.4" into refs/staging/5.4
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qnetworkaccessauthenticationmanager.cpp | 2 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessftpbackend.cpp | 20 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessftpbackend_p.h | 7 | ||||
-rw-r--r-- | src/network/kernel/qauthenticator.cpp | 4 | ||||
-rw-r--r-- | src/network/kernel/qurlinfo_p.h | 11 | ||||
-rw-r--r-- | src/network/socket/qhttpsocketengine.cpp | 10 | ||||
-rw-r--r-- | src/network/ssl/qsslcertificateextension_p.h | 11 | ||||
-rw-r--r-- | src/network/ssl/qsslcontext_openssl_p.h | 11 |
8 files changed, 57 insertions, 19 deletions
diff --git a/src/network/access/qnetworkaccessauthenticationmanager.cpp b/src/network/access/qnetworkaccessauthenticationmanager.cpp index ea7bdc198a..b92f9c1b9b 100644 --- a/src/network/access/qnetworkaccessauthenticationmanager.cpp +++ b/src/network/access/qnetworkaccessauthenticationmanager.cpp @@ -231,6 +231,8 @@ void QNetworkAccessAuthenticationManager::cacheCredentials(const QUrl &url, const QAuthenticator *authenticator) { Q_ASSERT(authenticator); + if (authenticator->isNull()) + return; QString domain = QString::fromLatin1("/"); // FIXME: make QAuthenticator return the domain QString realm = authenticator->realm(); diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp index 246eb41657..e8695f9b56 100644 --- a/src/network/access/qnetworkaccessftpbackend.cpp +++ b/src/network/access/qnetworkaccessftpbackend.cpp @@ -211,7 +211,7 @@ void QNetworkAccessFtpBackend::ftpConnectionReady(QNetworkAccessCache::Cacheable // no, defer the actual operation until after we've logged in } -void QNetworkAccessFtpBackend::disconnectFromFtp() +void QNetworkAccessFtpBackend::disconnectFromFtp(CacheCleanupMode mode) { state = Disconnecting; @@ -219,7 +219,12 @@ void QNetworkAccessFtpBackend::disconnectFromFtp() disconnect(ftp, 0, this, 0); QByteArray key = makeCacheKey(url()); - QNetworkAccessManagerPrivate::getObjectCache(this)->releaseEntry(key); + if (mode == RemoveCachedConnection) { + QNetworkAccessManagerPrivate::getObjectCache(this)->removeEntry(key); + ftp->dispose(); + } else { + QNetworkAccessManagerPrivate::getObjectCache(this)->releaseEntry(key); + } ftp = 0; } @@ -274,14 +279,7 @@ void QNetworkAccessFtpBackend::ftpDone() } // we're not connected, so remove the cache entry: - QByteArray key = makeCacheKey(url()); - QNetworkAccessManagerPrivate::getObjectCache(this)->removeEntry(key); - - disconnect(ftp, 0, this, 0); - ftp->dispose(); - ftp = 0; - - state = Disconnecting; + disconnectFromFtp(RemoveCachedConnection); finished(); return; } @@ -301,7 +299,7 @@ void QNetworkAccessFtpBackend::ftpDone() else error(QNetworkReply::ContentAccessDenied, msg); - disconnectFromFtp(); + disconnectFromFtp(RemoveCachedConnection); finished(); } diff --git a/src/network/access/qnetworkaccessftpbackend_p.h b/src/network/access/qnetworkaccessftpbackend_p.h index c006d450b8..534efad676 100644 --- a/src/network/access/qnetworkaccessftpbackend_p.h +++ b/src/network/access/qnetworkaccessftpbackend_p.h @@ -90,7 +90,12 @@ public: virtual void downstreamReadyWrite(); - void disconnectFromFtp(); + enum CacheCleanupMode { + ReleaseCachedConnection, + RemoveCachedConnection + }; + + void disconnectFromFtp(CacheCleanupMode mode = ReleaseCachedConnection); public slots: void ftpConnectionReady(QNetworkAccessCache::CacheableObject *object); diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index ea935869fb..c4c7abb240 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -439,9 +439,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QList<QPair<QByteArray, QByt phase = Done; break; case Ntlm: - // #### extract from header - if (user.isEmpty() && password.isEmpty()) - phase = Done; + // work is done in calculateResponse() break; case DigestMd5: { this->options[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm")); diff --git a/src/network/kernel/qurlinfo_p.h b/src/network/kernel/qurlinfo_p.h index 1aa59f25ad..31eb0730d3 100644 --- a/src/network/kernel/qurlinfo_p.h +++ b/src/network/kernel/qurlinfo_p.h @@ -42,6 +42,17 @@ #ifndef QURLINFO_H #define QURLINFO_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/qdatetime.h> #include <QtCore/qstring.h> #include <QtCore/qiodevice.h> diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp index 0a25815752..9f3c29e207 100644 --- a/src/network/socket/qhttpsocketengine.cpp +++ b/src/network/socket/qhttpsocketengine.cpp @@ -594,16 +594,18 @@ void QHttpSocketEngine::slotSocketReadNotification() priv = QAuthenticatorPrivate::getPrivate(d->authenticator); priv->hasFailed = false; } else if (statusCode == 407) { - if (d->credentialsSent) { + if (d->authenticator.isNull()) + d->authenticator.detach(); + priv = QAuthenticatorPrivate::getPrivate(d->authenticator); + + if (d->credentialsSent && priv->phase != QAuthenticatorPrivate::Phase2) { + // Remember that (e.g.) NTLM is two-phase, so only reset when the authentication is not currently in progress. //407 response again means the provided username/password were invalid. d->authenticator = QAuthenticator(); //this is needed otherwise parseHttpResponse won't set the state, and then signal isn't emitted. d->authenticator.detach(); priv = QAuthenticatorPrivate::getPrivate(d->authenticator); priv->hasFailed = true; } - else if (d->authenticator.isNull()) - d->authenticator.detach(); - priv = QAuthenticatorPrivate::getPrivate(d->authenticator); priv->parseHttpResponse(d->reply->header(), true); diff --git a/src/network/ssl/qsslcertificateextension_p.h b/src/network/ssl/qsslcertificateextension_p.h index cc04e76634..6891733174 100644 --- a/src/network/ssl/qsslcertificateextension_p.h +++ b/src/network/ssl/qsslcertificateextension_p.h @@ -42,6 +42,17 @@ #ifndef QSSLCERTIFICATEEXTENSION_P_H #define QSSLCERTIFICATEEXTENSION_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include "qsslcertificateextension.h" QT_BEGIN_NAMESPACE diff --git a/src/network/ssl/qsslcontext_openssl_p.h b/src/network/ssl/qsslcontext_openssl_p.h index 9fb9bd2204..d4ab91f8ec 100644 --- a/src/network/ssl/qsslcontext_openssl_p.h +++ b/src/network/ssl/qsslcontext_openssl_p.h @@ -44,6 +44,17 @@ #ifndef QSSLCONTEXT_OPENSSL_P_H #define QSSLCONTEXT_OPENSSL_P_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/qvariant.h> #include <QtNetwork/qsslcertificate.h> #include <QtNetwork/qsslconfiguration.h> |