summaryrefslogtreecommitdiffstats
path: root/src/network/access/qhttpnetworkconnectionchannel.cpp
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2011-07-12 12:45:02 +0200
committerQt by Nokia <qt-info@nokia.com>2011-07-12 13:57:14 +0200
commit37be55a86f78da6d177e387b79cbc5d2aacef773 (patch)
treee9afbd285268e09aee3898326176a6c534c24acd /src/network/access/qhttpnetworkconnectionchannel.cpp
parente11fac22c41f5f796bbfabc5088ff8a1cee3cd3b (diff)
QNAM HTTP: Do zero-copy for small HTTP replies by default
Task-Number: QTBUG-19046 Change-Id: I34bf432c81d94787524124b7d110a00305a660c1 Reviewed-on: http://codereview.qt.nokia.com/1516 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com> Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
Diffstat (limited to 'src/network/access/qhttpnetworkconnectionchannel.cpp')
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index b8ed8ee567..aafdbf7774 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -448,12 +448,17 @@ void QHttpNetworkConnectionChannel::_q_receiveReply()
// the buffer in that size.
// note that this call will read only from the still buffered data
qint64 haveRead = replyPrivate->readBodyVeryFast(socket, replyPrivate->userProvidedDownloadBuffer + replyPrivate->totalProgress);
- bytes += haveRead;
- replyPrivate->totalProgress += haveRead;
-
- // the user will get notified of it via progress signal
- if (haveRead > 0)
+ if (haveRead > 0) {
+ bytes += haveRead;
+ replyPrivate->totalProgress += haveRead;
+ // the user will get notified of it via progress signal
emit reply->dataReadProgress(replyPrivate->totalProgress, replyPrivate->bodyLength);
+ } else if (haveRead == 0) {
+ // Happens since this called in a loop. Currently no bytes available.
+ } else if (haveRead < 0) {
+ connection->d_func()->emitReplyError(socket, reply, QNetworkReply::RemoteHostClosedError);
+ break;
+ }
} else if (!replyPrivate->isChunked() && !replyPrivate->autoDecompress
&& replyPrivate->bodyLength > 0) {
// bulk files like images should fulfill these properties and