summaryrefslogtreecommitdiffstats
path: root/src/network/access/qnetworkreplyhttpimpl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/access/qnetworkreplyhttpimpl.cpp')
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index 1cb6065a66..9409006abe 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -1000,7 +1000,7 @@ void QNetworkReplyHttpImplPrivate::replyDownloadData(QByteArray d)
QByteDataBuffer pendingDownloadDataCopy = pendingDownloadData;
pendingDownloadData.clear();
- if (cacheEnabled && !cacheSaveDevice) {
+ if (cacheEnabled && isCachingAllowed() && !cacheSaveDevice) {
initCacheSaveDevice();
}
@@ -1170,7 +1170,7 @@ void QNetworkReplyHttpImplPrivate::replyDownloadProgressSlot(qint64 bytesReceive
if (!q->isOpen())
return;
- if (cacheEnabled && bytesReceived == bytesTotal) {
+ if (cacheEnabled && isCachingAllowed() && bytesReceived == bytesTotal) {
// Write everything in one go if we use a download buffer. might be more performant.
initCacheSaveDevice();
// need to check again if cache enabled and device exists
@@ -2027,6 +2027,11 @@ void QNetworkReplyHttpImplPrivate::setCachingEnabled(bool enable)
}
}
+bool QNetworkReplyHttpImplPrivate::isCachingAllowed() const
+{
+ return operation == QNetworkAccessManager::GetOperation || operation == QNetworkAccessManager::HeadOperation;
+}
+
void QNetworkReplyHttpImplPrivate::completeCacheSave()
{
if (cacheEnabled && errorCode != QNetworkReplyImpl::NoError) {