summaryrefslogtreecommitdiffstats
path: root/src/network/access
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-05-19 13:31:25 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-05-19 13:31:25 (GMT)
commit78dcac759d500c1744751955623b1d0babcd37a4 (patch)
tree59d7a2540c2fcffe0b274afbf85db9a1f53242f4 /src/network/access
parentf1c79b3c90c1e14d8bee0228e3e416fa5337cf6e (diff)
parentde0858687898f6e0e54cce3f986779c7aa1a350e (diff)
downloadQt-78dcac759d500c1744751955623b1d0babcd37a4.zip
Qt-78dcac759d500c1744751955623b1d0babcd37a4.tar.gz
Qt-78dcac759d500c1744751955623b1d0babcd37a4.tar.bz2
Merge remote branch 'origin/4.7' into HEAD
Conflicts: src/corelib/tools/qlocale_symbian.cpp
Diffstat (limited to 'src/network/access')
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp28
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp3
-rw-r--r--src/network/access/qhttpnetworkreply.cpp3
-rw-r--r--src/network/access/qnetworkaccessbackend.cpp2
-rw-r--r--src/network/access/qnetworkaccesshttpbackend_p.h2
5 files changed, 19 insertions, 19 deletions
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 31c64f0..1afabec 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -723,6 +723,7 @@ void QHttpNetworkConnectionPrivate::removeReply(QHttpNetworkReply *reply)
// This function must be called from the event loop. The only
// exception is documented in QHttpNetworkConnectionPrivate::queueRequest
+// although it is called _q_startNextRequest, it will actually start multiple requests when possible
void QHttpNetworkConnectionPrivate::_q_startNextRequest()
{
//resend the necessary ones.
@@ -740,26 +741,23 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
// dequeue new ones
- QAbstractSocket *socket = 0;
+ // return fast if there is nothing to do
+ if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty())
+ return;
+ // try to get a free AND connected socket
for (int i = 0; i < channelCount; ++i) {
- QAbstractSocket *chSocket = channels[i].socket;
- // try to get a free AND connected socket
if (!channels[i].isSocketBusy() && channels[i].socket->state() == QAbstractSocket::ConnectedState) {
- socket = chSocket;
- dequeueAndSendRequest(socket);
- break;
+ dequeueAndSendRequest(channels[i].socket);
}
}
- if (!socket) {
- for (int i = 0; i < channelCount; ++i) {
- QAbstractSocket *chSocket = channels[i].socket;
- // try to get a free unconnected socket
- if (!channels[i].isSocketBusy()) {
- socket = chSocket;
- dequeueAndSendRequest(socket);
- break;
- }
+ // return fast if there is nothing to do
+ if (highPriorityQueue.isEmpty() && lowPriorityQueue.isEmpty())
+ return;
+ // try to get a free unconnected socket
+ for (int i = 0; i < channelCount; ++i) {
+ if (!channels[i].isSocketBusy()) {
+ dequeueAndSendRequest(channels[i].socket);
}
}
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index d24eb1f..d3576dd 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -294,7 +294,8 @@ bool QHttpNetworkConnectionChannel::sendRequest()
// ensure we try to receive a reply in all cases, even if _q_readyRead_ hat not been called
// this is needed if the sends an reply before we have finished sending the request. In that
// case receiveReply had been called before but ignored the server reply
- QMetaObject::invokeMethod(this, "_q_receiveReply", Qt::QueuedConnection);
+ if (socket->bytesAvailable())
+ QMetaObject::invokeMethod(this, "_q_receiveReply", Qt::QueuedConnection);
break;
}
case QHttpNetworkConnectionChannel::ReadingState:
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index 338236e..108ba8a 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -179,6 +179,9 @@ qint64 QHttpNetworkReply::bytesAvailableNextBlock() const
QByteArray QHttpNetworkReply::readAny()
{
Q_D(QHttpNetworkReply);
+ if (d->responseData.bufferCount() == 0)
+ return QByteArray();
+
// we'll take the last buffer, so schedule another read from http
if (d->downstreamLimited && d->responseData.bufferCount() == 1)
d->connection->d_func()->readMoreLater(this);
diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp
index 2a02c99..60f7dc6 100644
--- a/src/network/access/qnetworkaccessbackend.cpp
+++ b/src/network/access/qnetworkaccessbackend.cpp
@@ -74,7 +74,7 @@ Q_GLOBAL_STATIC(QNetworkAccessBackendFactoryData, factoryData)
QNetworkAccessBackendFactory::QNetworkAccessBackendFactory()
{
QMutexLocker locker(&factoryData()->mutex);
- factoryData()->prepend(this);
+ factoryData()->append(this);
}
QNetworkAccessBackendFactory::~QNetworkAccessBackendFactory()
diff --git a/src/network/access/qnetworkaccesshttpbackend_p.h b/src/network/access/qnetworkaccesshttpbackend_p.h
index 254907f..c4c88ae 100644
--- a/src/network/access/qnetworkaccesshttpbackend_p.h
+++ b/src/network/access/qnetworkaccesshttpbackend_p.h
@@ -94,8 +94,6 @@ public:
#endif
QNetworkCacheMetaData fetchCacheMetaData(const QNetworkCacheMetaData &metaData) const;
- qint64 deviceReadData(char *buffer, qint64 maxlen);
-
// we return true since HTTP needs to send PUT/POST data again after having authenticated
bool needsResetableUploadData() { return true; }