summaryrefslogtreecommitdiffstats
path: root/src/network/access/qnetworkreplyhttpimpl.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-29 12:56:06 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-29 12:56:06 +0200
commitea9003268556154fdc305aa745890fdea92ac46b (patch)
treea3ed6fc20fe4be0d7d07f752942cd5b7e2e3c7de /src/network/access/qnetworkreplyhttpimpl.cpp
parentc67f7c0f0fc34887a4922a269815c460cbe3ccf8 (diff)
parent7e74f8f398deb8ed84f6c4613de6dab2066dc9de (diff)
Merge remote-tracking branch 'origin/5.3' into dev
Conflicts: src/network/ssl/qsslsocket_openssl_symbols.cpp Change-Id: Ic62419fa1fee5f4de6c372459d72e6e16f9a810b
Diffstat (limited to 'src/network/access/qnetworkreplyhttpimpl.cpp')
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index 3ac8b8f56f..c5cf849a55 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -867,6 +867,11 @@ void QNetworkReplyHttpImplPrivate::postRequest()
forwardUploadDevice->setParent(delegate); // needed to make sure it is moved on moveToThread()
delegate->httpRequest.setUploadByteDevice(forwardUploadDevice);
+ // If the device in the user thread claims it has more data, keep the flow to HTTP thread going
+ QObject::connect(uploadByteDevice.data(), SIGNAL(readyRead()),
+ q, SLOT(uploadByteDeviceReadyReadSlot()),
+ Qt::QueuedConnection);
+
// From main thread to user thread:
QObject::connect(q, SIGNAL(haveUploadData(QByteArray,bool,qint64)),
forwardUploadDevice, SLOT(haveDataSlot(QByteArray,bool,qint64)), Qt::QueuedConnection);
@@ -1288,6 +1293,13 @@ void QNetworkReplyHttpImplPrivate::wantUploadDataSlot(qint64 maxSize)
// call readPointer
qint64 currentUploadDataLength = 0;
char *data = const_cast<char*>(uploadByteDevice->readPointer(maxSize, currentUploadDataLength));
+
+ if (currentUploadDataLength == 0) {
+ // No bytes from upload byte device. There will be bytes later, it will emit readyRead()
+ // and our uploadByteDeviceReadyReadSlot() is called.
+ return;
+ }
+
// Let's make a copy of this data
QByteArray dataArray(data, currentUploadDataLength);
@@ -1295,6 +1307,13 @@ void QNetworkReplyHttpImplPrivate::wantUploadDataSlot(qint64 maxSize)
emit q->haveUploadData(dataArray, uploadByteDevice->atEnd(), uploadByteDevice->size());
}
+void QNetworkReplyHttpImplPrivate::uploadByteDeviceReadyReadSlot()
+{
+ // Start the flow between this thread and the HTTP thread again by triggering a upload.
+ wantUploadDataSlot(1024);
+}
+
+
/*
A simple web page that can be used to test us: http://www.procata.com/cachetest/
*/