diff options
-rw-r--r-- | src/network/kernel/qauthenticator.cpp | 4 | ||||
-rw-r--r-- | src/network/socket/qhttpsocketengine.cpp | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index f7b956651f..c582e95b1c 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -430,9 +430,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/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); |