diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2010-10-19 14:19:29 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2010-10-27 12:40:27 (GMT) |
commit | 04cc5144a8d1d1eb51fb627327e155649ba2ce45 (patch) | |
tree | 1ed5a32ae0f76898ae942ee73b24ec362e05af1d /src/network/access | |
parent | 07fd031d29198cc5a0d6f1da6bb8fea29274fa06 (diff) | |
download | Qt-04cc5144a8d1d1eb51fb627327e155649ba2ce45.zip Qt-04cc5144a8d1d1eb51fb627327e155649ba2ce45.tar.gz Qt-04cc5144a8d1d1eb51fb627327e155649ba2ce45.tar.bz2 |
QNAM HTTP: Process authenticationRequired() from HTTP properly
Fixes a bug where a different QNetworkReply(Impl) handles an
authentication request.
Reviewed-by: Peter Hartmann
Reviewed-by: Prasanth
Task-Number: QTBUG-13234
Diffstat (limited to 'src/network/access')
-rw-r--r-- | src/network/access/qhttpnetworkconnection.cpp | 2 | ||||
-rw-r--r-- | src/network/access/qhttpnetworkconnection_p.h | 2 | ||||
-rw-r--r-- | src/network/access/qnetworkaccesshttpbackend.cpp | 11 | ||||
-rw-r--r-- | src/network/access/qnetworkaccesshttpbackend_p.h | 2 |
4 files changed, 10 insertions, 7 deletions
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index f8f7620..f6cb530 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -350,7 +350,7 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket if (priv->phase == QAuthenticatorPrivate::Done) { pauseConnection(); if (!isProxy) { - emit q->authenticationRequired(reply->request(), auth, q); + emit q->authenticationRequired(reply, reply->request(), auth, q); #ifndef QT_NO_NETWORKPROXY } else { emit q->proxyAuthenticationRequired(networkProxy, auth, q); diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index f2e0b1c..875c978 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -131,7 +131,7 @@ Q_SIGNALS: void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator, const QHttpNetworkConnection *connection = 0); #endif - void authenticationRequired(const QHttpNetworkRequest &request, QAuthenticator *authenticator, + void authenticationRequired(const QHttpNetworkReply*, const QHttpNetworkRequest &request, QAuthenticator *authenticator, const QHttpNetworkConnection *connection = 0); void cacheCredentials(const QHttpNetworkRequest &request, QAuthenticator *authenticator, const QHttpNetworkConnection *connection = 0); diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index f617244..2af4987 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -344,8 +344,8 @@ void QNetworkAccessHttpBackend::setupConnection() connect(http, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); #endif - connect(http, SIGNAL(authenticationRequired(QHttpNetworkRequest,QAuthenticator*)), - SLOT(httpAuthenticationRequired(QHttpNetworkRequest,QAuthenticator*))); + connect(http, SIGNAL(authenticationRequired(const QHttpNetworkReply*, QHttpNetworkRequest,QAuthenticator*,const QHttpNetworkConnection*)), + SLOT(httpAuthenticationRequired(const QHttpNetworkReply*, QHttpNetworkRequest,QAuthenticator*))); connect(http, SIGNAL(cacheCredentials(QHttpNetworkRequest,QAuthenticator*)), SLOT(httpCacheCredentials(QHttpNetworkRequest,QAuthenticator*))); connect(http, SIGNAL(error(QNetworkReply::NetworkError,QString)), @@ -862,10 +862,13 @@ void QNetworkAccessHttpBackend::replyHeaderChanged() metaDataChanged(); } -void QNetworkAccessHttpBackend::httpAuthenticationRequired(const QHttpNetworkRequest &, +void QNetworkAccessHttpBackend::httpAuthenticationRequired(const QHttpNetworkReply *reply, + const QHttpNetworkRequest &, QAuthenticator *auth) { - authenticationRequired(auth); + // Only process this signal when it is for the QHttpNetworkReply that we actually have + if (reply == this->httpReply) + authenticationRequired(auth); } void QNetworkAccessHttpBackend::httpCacheCredentials(const QHttpNetworkRequest &, diff --git a/src/network/access/qnetworkaccesshttpbackend_p.h b/src/network/access/qnetworkaccesshttpbackend_p.h index c4c88ae..f06f364 100644 --- a/src/network/access/qnetworkaccesshttpbackend_p.h +++ b/src/network/access/qnetworkaccesshttpbackend_p.h @@ -104,7 +104,7 @@ private slots: void replyReadyRead(); void replyFinished(); void replyHeaderChanged(); - void httpAuthenticationRequired(const QHttpNetworkRequest &request, QAuthenticator *auth); + void httpAuthenticationRequired(const QHttpNetworkReply*, const QHttpNetworkRequest &request, QAuthenticator *auth); void httpCacheCredentials(const QHttpNetworkRequest &request, QAuthenticator *auth); void httpError(QNetworkReply::NetworkError error, const QString &errorString); bool sendCacheContents(const QNetworkCacheMetaData &metaData); |