summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2010-10-27 12:06:28 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2010-10-27 12:40:29 (GMT)
commitb5d9dbf28b78aa17bfb70aa2e5fd3da99fe53ff0 (patch)
treed70c90f14ad4fd095142cdf034c67f2c23da4d52 /src
parentbe18016694c57fef508aa4715f5b8f9bbf21e5ac (diff)
downloadQt-b5d9dbf28b78aa17bfb70aa2e5fd3da99fe53ff0.zip
Qt-b5d9dbf28b78aa17bfb70aa2e5fd3da99fe53ff0.tar.gz
Qt-b5d9dbf28b78aa17bfb70aa2e5fd3da99fe53ff0.tar.bz2
QNAM HTTP: Remove the error() of QHttpNetworkConnection
Removed the distinction between reply error and connection error. The QNetworkAccessManager was treating them the same way anyway. Reviewed-by: Prasanth Task-Number: QTBUG-13234
Diffstat (limited to 'src')
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp3
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h3
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp24
-rw-r--r--src/network/access/qnetworkaccesshttpbackend.cpp7
-rw-r--r--src/network/access/qnetworkaccesshttpbackend_p.h1
5 files changed, 9 insertions, 29 deletions
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 3acaaff..92f8af7 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -377,8 +377,7 @@ bool QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(QAbstractSocket
? QNetworkReply::ProxyAuthenticationRequiredError
: QNetworkReply::AuthenticationRequiredError;
reply->d_func()->errorString = errorDetail(errorCode, socket);
- emit q->error(errorCode, reply->d_func()->errorString);
- emit channels[i].reply->finished();
+ emit reply->finishedWithError(errorCode, reply->d_func()->errorString);
// ### at this point the reply could be deleted
socket->close();
return true;
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index 5d5caa6..8461426c 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -116,9 +116,6 @@ public:
void ignoreSslErrors(const QList<QSslError> &errors, int channel = -1);
#endif
-Q_SIGNALS:
- void error(QNetworkReply::NetworkError errorCode, const QString &detail = QString());
-
private:
Q_DECLARE_PRIVATE(QHttpNetworkConnection)
Q_DISABLE_COPY(QHttpNetworkConnection)
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 52a8e72..4e5de53 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -797,8 +797,7 @@ void QHttpNetworkConnectionChannel::handleStatus()
? QNetworkReply::ProxyAuthenticationRequiredError
: QNetworkReply::AuthenticationRequiredError;
reply->d_func()->errorString = connection->d_func()->errorDetail(errorCode, socket);
- emit connection->error(errorCode, reply->d_func()->errorString);
- emit reply->finished();
+ emit reply->finishedWithError(errorCode, reply->d_func()->errorString);
}
break;
default:
@@ -945,7 +944,6 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
{
if (!socket)
return;
- bool send2Reply = false;
QNetworkReply::NetworkError errorCode = QNetworkReply::UnknownNetworkError;
switch (socketError) {
@@ -963,7 +961,6 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
closeAndResendCurrentRequest();
return;
} else {
- send2Reply = true;
errorCode = QNetworkReply::RemoteHostClosedError;
}
} else {
@@ -976,7 +973,6 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
closeAndResendCurrentRequest();
return;
}
- send2Reply = true;
errorCode = QNetworkReply::TimeoutError;
break;
case QAbstractSocket::ProxyAuthenticationRequiredError:
@@ -992,18 +988,14 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
}
QPointer<QHttpNetworkConnection> that = connection;
QString errorString = connection->d_func()->errorDetail(errorCode, socket, socket->errorString());
- if (send2Reply) {
- if (reply) {
- reply->d_func()->errorString = errorString;
- // this error matters only to this reply
- emit reply->finishedWithError(errorCode, errorString);
- }
- // send the next request
- QMetaObject::invokeMethod(that, "_q_startNextRequest", Qt::QueuedConnection);
- } else {
- // the failure affects all requests.
- emit connection->error(errorCode, errorString);
+
+ if (reply) {
+ reply->d_func()->errorString = errorString;
+ emit reply->finishedWithError(errorCode, errorString);
}
+ // send the next request
+ QMetaObject::invokeMethod(that, "_q_startNextRequest", Qt::QueuedConnection);
+
if (that) //signal emission triggered event loop
close();
}
diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp
index ec10d34..2a0daf8 100644
--- a/src/network/access/qnetworkaccesshttpbackend.cpp
+++ b/src/network/access/qnetworkaccesshttpbackend.cpp
@@ -338,12 +338,6 @@ void QNetworkAccessHttpBackend::finished()
QNetworkAccessBackend::finished();
}
-void QNetworkAccessHttpBackend::setupConnection()
-{
- connect(http, SIGNAL(error(QNetworkReply::NetworkError,QString)),
- SLOT(httpError(QNetworkReply::NetworkError,QString)));
-}
-
/*
For a given httpRequest
1) If AlwaysNetwork, return
@@ -672,7 +666,6 @@ void QNetworkAccessHttpBackend::open()
cache->addEntry(cacheKey, http);
}
- setupConnection();
postRequest();
}
diff --git a/src/network/access/qnetworkaccesshttpbackend_p.h b/src/network/access/qnetworkaccesshttpbackend_p.h
index c4c88ae..568b2ee 100644
--- a/src/network/access/qnetworkaccesshttpbackend_p.h
+++ b/src/network/access/qnetworkaccesshttpbackend_p.h
@@ -125,7 +125,6 @@ private:
quint64 resumeOffset;
void disconnectFromHttp();
- void setupConnection();
void validateCache(QHttpNetworkRequest &httpRequest, bool &loadedFromCache);
void invalidateCache();
void postRequest();