summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-05-19 08:49:03 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-05-19 08:49:03 (GMT)
commitc6f8b600cb1635bef425b3d2232213fb41ea96bd (patch)
tree77f384a62f76de02d9765d615966327b91e4bb4a /src/network
parent6cc1e0106845a0dfe9433c4413b3c064c73ccfe2 (diff)
parent9f9ede616079998f8ba7bf6fd446f39ce74b0400 (diff)
downloadQt-c6f8b600cb1635bef425b3d2232213fb41ea96bd.zip
Qt-c6f8b600cb1635bef425b3d2232213fb41ea96bd.tar.gz
Qt-c6f8b600cb1635bef425b3d2232213fb41ea96bd.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/network')
-rw-r--r--src/network/access/qhttp.cpp2
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp47
2 files changed, 29 insertions, 20 deletions
diff --git a/src/network/access/qhttp.cpp b/src/network/access/qhttp.cpp
index 96ccc91..2002641 100644
--- a/src/network/access/qhttp.cpp
+++ b/src/network/access/qhttp.cpp
@@ -1446,7 +1446,7 @@ QString QHttpRequestHeader::toString() const
that indicates if the request finished with an error.
To make an HTTP request you must set up suitable HTTP headers. The
- following example demonstrates, how to request the main HTML page
+ following example demonstrates how to request the main HTML page
from the Trolltech home page (i.e., the URL
\c http://qtsoftware.com/index.html):
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index d4bf008..43fbb16 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -703,27 +703,37 @@ 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 +836,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