From fb404765a5af559598dc5b3906e45d8c5e48884b Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 26 Oct 2010 15:48:42 +0200 Subject: QNAM HTTP: Move proxyAuthenticationRequired() to QHttpNetworkReply Reviewed-by: Prasanth Task-Number: QTBUG-13234 --- src/network/access/qhttpnetworkconnection.cpp | 5 ++--- src/network/access/qhttpnetworkconnection_p.h | 5 ----- src/network/access/qhttpnetworkreply_p.h | 4 +++- src/network/access/qnetworkaccesshttpbackend.cpp | 8 ++++---- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 1166a9a..f266322 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -354,7 +354,7 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket emit q->authenticationRequired(reply, reply->request(), auth, q); #ifndef QT_NO_NETWORKPROXY } else { - emit q->proxyAuthenticationRequired(networkProxy, auth, q); + emit reply->proxyAuthenticationRequired(networkProxy, auth); #endif } resumeConnection(); @@ -963,11 +963,10 @@ void QHttpNetworkConnection::ignoreSslErrors(const QList &errors, int // e.g. it is for SOCKS proxies which require authentication. void QHttpNetworkConnectionPrivate::emitProxyAuthenticationRequired(const QHttpNetworkConnectionChannel *chan, const QNetworkProxy &proxy, QAuthenticator* auth) { - Q_Q(QHttpNetworkConnection); // Also pause the connection because socket notifiers may fire while an user // dialog is displaying pauseConnection(); - emit q->proxyAuthenticationRequired(proxy, auth, q); + emit chan->reply->proxyAuthenticationRequired(proxy, auth); resumeConnection(); int i = indexOf(chan->socket); copyCredentials(i, auth, true); diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index f8c4bb4..af33bf9 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -123,11 +123,6 @@ public: #endif Q_SIGNALS: -#ifndef QT_NO_NETWORKPROXY - //cannot be used with queued connection. - void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator, - const QHttpNetworkConnection *connection = 0); -#endif void authenticationRequired(const QHttpNetworkReply*, const QHttpNetworkRequest &request, QAuthenticator *authenticator, const QHttpNetworkConnection *connection = 0); void error(QNetworkReply::NetworkError errorCode, const QString &detail = QString()); diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h index 79966fd..b4a14f9 100644 --- a/src/network/access/qhttpnetworkreply_p.h +++ b/src/network/access/qhttpnetworkreply_p.h @@ -152,7 +152,9 @@ Q_SIGNALS: void dataReadProgress(int done, int total); void dataSendProgress(qint64 done, qint64 total); void cacheCredentials(const QHttpNetworkRequest &request, QAuthenticator *authenticator); - +#ifndef QT_NO_NETWORKPROXY + void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator); +#endif private: Q_DECLARE_PRIVATE(QHttpNetworkReply) friend class QHttpNetworkConnection; diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index 3bad2fe..3611e77 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -340,10 +340,6 @@ void QNetworkAccessHttpBackend::finished() void QNetworkAccessHttpBackend::setupConnection() { -#ifndef QT_NO_NETWORKPROXY - connect(http, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), - SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); -#endif connect(http, SIGNAL(authenticationRequired(const QHttpNetworkReply*, QHttpNetworkRequest,QAuthenticator*,const QHttpNetworkConnection*)), SLOT(httpAuthenticationRequired(const QHttpNetworkReply*, QHttpNetworkRequest,QAuthenticator*))); connect(http, SIGNAL(error(QNetworkReply::NetworkError,QString)), @@ -598,6 +594,10 @@ void QNetworkAccessHttpBackend::postRequest() connect(httpReply, SIGNAL(headerChanged()), SLOT(replyHeaderChanged())); connect(httpReply, SIGNAL(cacheCredentials(QHttpNetworkRequest,QAuthenticator*)), SLOT(httpCacheCredentials(QHttpNetworkRequest,QAuthenticator*))); +#ifndef QT_NO_NETWORKPROXY + connect(httpReply, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), + SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); +#endif } void QNetworkAccessHttpBackend::invalidateCache() -- cgit v0.12