diff options
author | Peter Hartmann <peter.hartmann@trolltech.com> | 2009-05-14 09:21:25 (GMT) |
---|---|---|
committer | Peter Hartmann <peter.hartmann@trolltech.com> | 2009-05-15 12:10:19 (GMT) |
commit | d216c0fd62a879fd1eb84e087f70c7f542d75d58 (patch) | |
tree | 47e2f920a35ed7ea9095a14a9575b3cace8ba694 /src | |
parent | 9c3f5040bc9b80619ebe167c352ac8f0394f9b41 (diff) | |
download | Qt-d216c0fd62a879fd1eb84e087f70c7f542d75d58.zip Qt-d216c0fd62a879fd1eb84e087f70c7f542d75d58.tar.gz Qt-d216c0fd62a879fd1eb84e087f70c7f542d75d58.tar.bz2 |
HTTP authentication: return error if authentication cannot be handled
return error upon receiving an unknown authentication method (e.g.
WSSE); before we were just silently returning.
Reviewed-by: Thiago Macieira
Diffstat (limited to 'src')
-rw-r--r-- | src/network/access/qhttpnetworkconnection.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index f558f2b..ae518df 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -643,10 +643,21 @@ void QHttpNetworkConnectionPrivate::handleStatus(QAbstractSocket *socket, QHttpN switch (statusCode) { case 401: case 407: - handleAuthenticateChallenge(socket, reply, (statusCode == 407), resend); - if (resend) { - eraseData(reply); - sendRequest(socket); + if (handleAuthenticateChallenge(socket, reply, (statusCode == 407), resend)) { + if (resend) { + eraseData(reply); + sendRequest(socket); + } + } else { + int i = indexOf(socket); + emit channels[i].reply->headerChanged(); + emit channels[i].reply->readyRead(); + QNetworkReply::NetworkError errorCode = (statusCode == 407) + ? QNetworkReply::ProxyAuthenticationRequiredError + : QNetworkReply::AuthenticationRequiredError; + reply->d_func()->errorString = errorDetail(errorCode, socket); + emit q->error(errorCode, reply->d_func()->errorString); + emit channels[i].reply->finished(); } break; default: @@ -749,7 +760,6 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket // authentication is cancelled, send the current contents to the user. emit channels[i].reply->headerChanged(); emit channels[i].reply->readyRead(); - emit channels[i].reply->finished(); QNetworkReply::NetworkError errorCode = isProxy ? QNetworkReply::ProxyAuthenticationRequiredError |