summaryrefslogtreecommitdiffstats
path: root/src/core/net/url_request_custom_job_proxy.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-01-23 11:01:28 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-01-23 11:01:28 +0100
commit96ec21dc0b6560cb2b86b744393b69b655af655b (patch)
treee3d03ceb9c021c6e0d67aacc50691eb60ca932e3 /src/core/net/url_request_custom_job_proxy.cpp
parentc67337856dbaf66df813a176379a9f0a6fda2470 (diff)
parentd7d40469b5bfad2cc1693ef663864d2b15d59687 (diff)
Merge branch '5.14' into 5.15
Diffstat (limited to 'src/core/net/url_request_custom_job_proxy.cpp')
-rw-r--r--src/core/net/url_request_custom_job_proxy.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/core/net/url_request_custom_job_proxy.cpp b/src/core/net/url_request_custom_job_proxy.cpp
index cd7e173ee..d2df64f2f 100644
--- a/src/core/net/url_request_custom_job_proxy.cpp
+++ b/src/core/net/url_request_custom_job_proxy.cpp
@@ -96,9 +96,14 @@ void URLRequestCustomJobProxy::reply(std::string mimeType, QIODevice *device)
if (m_client->m_device && !m_client->m_device->isReadable())
m_client->m_device->open(QIODevice::ReadOnly);
- qint64 size = m_client->m_device ? m_client->m_device->size() : -1;
- if (size > 0)
- m_client->notifyExpectedContentSize(size);
+ if (m_client->m_firstBytePosition > 0)
+ m_client->m_device->seek(m_client->m_firstBytePosition);
+
+ qint64 deviceSize = m_client->m_device ? m_client->m_device->size() : -1;
+ qint64 remainingBytes = deviceSize - m_client->m_firstBytePosition;
+ if (remainingBytes > 0)
+ m_client->notifyExpectedContentSize(remainingBytes);
+
if (m_client->m_device && m_client->m_device->isReadable()) {
m_started = true;
m_client->notifyHeadersComplete();