QNAM: Improve internal proxyAuthenticationRequired()
Make it independent from the backend architecture to improve refactorability. Reviewed-by: Peter Hartmann
This commit is contained in:
parent
856da3ee19
commit
be4d62d3b7
@ -315,7 +315,7 @@ void QNetworkAccessBackend::error(QNetworkReply::NetworkError code, const QStrin
|
||||
void QNetworkAccessBackend::proxyAuthenticationRequired(const QNetworkProxy &proxy,
|
||||
QAuthenticator *authenticator)
|
||||
{
|
||||
manager->proxyAuthenticationRequired(this, proxy, authenticator);
|
||||
manager->proxyAuthenticationRequired(proxy, synchronous, authenticator, &reply->lastProxyAuthentication);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1088,9 +1088,10 @@ void QNetworkAccessManagerPrivate::authenticationRequired(QAuthenticator *authen
|
||||
}
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
void QNetworkAccessManagerPrivate::proxyAuthenticationRequired(QNetworkAccessBackend *backend,
|
||||
const QNetworkProxy &proxy,
|
||||
QAuthenticator *authenticator)
|
||||
void QNetworkAccessManagerPrivate::proxyAuthenticationRequired(const QNetworkProxy &proxy,
|
||||
bool synchronous,
|
||||
QAuthenticator *authenticator,
|
||||
QNetworkProxy *lastProxyAuthentication)
|
||||
{
|
||||
Q_Q(QNetworkAccessManager);
|
||||
// ### FIXME Tracking of successful authentications
|
||||
@ -1100,7 +1101,7 @@ void QNetworkAccessManagerPrivate::proxyAuthenticationRequired(QNetworkAccessBac
|
||||
// proxyAuthenticationRequired gets emitted again
|
||||
// possible solution: some tracking inside the authenticator
|
||||
// or a new function proxyAuthenticationSucceeded(true|false)
|
||||
if (proxy != backend->reply->lastProxyAuthentication) {
|
||||
if (proxy != *lastProxyAuthentication) {
|
||||
QNetworkAuthenticationCredential cred = authenticationManager->fetchCachedProxyCredentials(proxy);
|
||||
if (!cred.isNull()) {
|
||||
authenticator->setUser(cred.user);
|
||||
@ -1111,10 +1112,10 @@ void QNetworkAccessManagerPrivate::proxyAuthenticationRequired(QNetworkAccessBac
|
||||
|
||||
// if we emit a signal here in synchronous mode, the user might spin
|
||||
// an event loop, which might recurse and lead to problems
|
||||
if (backend->isSynchronous())
|
||||
if (synchronous)
|
||||
return;
|
||||
|
||||
backend->reply->lastProxyAuthentication = proxy;
|
||||
*lastProxyAuthentication = proxy;
|
||||
emit q->proxyAuthenticationRequired(proxy, authenticator);
|
||||
authenticationManager->cacheProxyCredentials(proxy, authenticator);
|
||||
}
|
||||
|
@ -104,8 +104,10 @@ public:
|
||||
const QAuthenticator *auth = 0);
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
void proxyAuthenticationRequired(QNetworkAccessBackend *backend, const QNetworkProxy &proxy,
|
||||
QAuthenticator *authenticator);
|
||||
void proxyAuthenticationRequired(const QNetworkProxy &proxy,
|
||||
bool synchronous,
|
||||
QAuthenticator *authenticator,
|
||||
QNetworkProxy *lastProxyAuthentication);
|
||||
void cacheProxyCredentials(const QNetworkProxy &proxy, const QAuthenticator *auth);
|
||||
QNetworkAuthenticationCredential *fetchCachedProxyCredentials(const QNetworkProxy &proxy,
|
||||
const QAuthenticator *auth = 0);
|
||||
|
Loading…
Reference in New Issue
Block a user