diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-05-18 14:31:07 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-05-18 14:31:07 (GMT) |
commit | f3988241faa59596c1702b31e7bec9538f33ee79 (patch) | |
tree | 39cc06b8455545cd1fd754c44838afcc3a0bdaac /src/network/access/qhttpnetworkconnection.cpp | |
parent | 7e4d4474d10cb17047d95e3a4820388468c74507 (diff) | |
parent | 5c25207628fbcc94e92b129ac7660af14613ad85 (diff) | |
download | Qt-f3988241faa59596c1702b31e7bec9538f33ee79.zip Qt-f3988241faa59596c1702b31e7bec9538f33ee79.tar.gz Qt-f3988241faa59596c1702b31e7bec9538f33ee79.tar.bz2 |
Merge commit 'origin/4.5'
Conflicts:
src/corelib/kernel/qobject.cpp
src/corelib/kernel/qobject_p.h
src/network/access/qhttpnetworkconnection.cpp
Diffstat (limited to 'src/network/access/qhttpnetworkconnection.cpp')
-rw-r--r-- | src/network/access/qhttpnetworkconnection.cpp | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index d4bf008..161e6e9 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -703,27 +703,36 @@ void QHttpNetworkConnectionPrivate::handleStatus(QAbstractSocket *socket, QHttpN switch (statusCode) { case 401: case 407: - handleAuthenticateChallenge(socket, reply, (statusCode == 407), resend); - if (resend) { - int i = indexOf(socket); - - QNonContiguousByteDevice* uploadByteDevice = channels[i].request.uploadByteDevice(); - if (uploadByteDevice) { - if (uploadByteDevice->reset()) { - channels[i].written = 0; - } else { - emitReplyError(socket, reply, QNetworkReply::ContentReSendError); - break; + if (handleAuthenticateChallenge(socket, reply, (statusCode == 407), resend)) { + if (resend) { + int i = indexOf(socket); + + QNonContiguousByteDevice* uploadByteDevice = channels[i].request.uploadByteDevice(); + if (uploadByteDevice) { + if (uploadByteDevice->reset()) { + channels[i].written = 0; + } else { + emitReplyError(socket, reply, QNetworkReply::ContentReSendError); + break; + } } - } - - eraseData(reply); - // also use async _q_startNextRequest so we dont break with closed - // proxy or server connections.. - channels[i].resendCurrent = true; - QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); + eraseData(reply); + // also use async _q_startNextRequest so we dont break with closed + // proxy or server connections.. + channels[i].resendCurrent = true; + QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); + } 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: @@ -826,7 +835,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 |