summaryrefslogtreecommitdiffstats
path: root/src/network/access/qnetworkdiskcache.cpp
diff options
context:
space:
mode:
authorMÃ¥rten Nordheim <marten.nordheim@qt.io>2023-03-03 19:08:23 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-03-14 16:40:17 +0000
commit45b691f022c34512dd3f1b1caff6737702d5073a (patch)
treef0f7d72b5166e8eae007a23b2131c39d410e0f91 /src/network/access/qnetworkdiskcache.cpp
parent96da9eeb7a5ca5f99a17d12b41877ad5b5ef3acd (diff)
QNetwork[http]: Discard or ignore corrupted cache entries
In an attempt to avoid situations like the linked bug-report from happening again, discard cached entries with no headers and ignore entries where the payload is smaller than what the header specified (if it specified anything). In a future revision we might want to add a length to the cache's metadata, potentially with a checksum trailing the content. Task-number: QTBUG-111397 Change-Id: Ie40149ffdaff7886bcd44cbd45605bdb7918e105 Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit a6776de0c70d23ac197682c7bef603450cb8b03f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/network/access/qnetworkdiskcache.cpp')
-rw-r--r--src/network/access/qnetworkdiskcache.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp
index cf6f0a9b14..2fcbd393dc 100644
--- a/src/network/access/qnetworkdiskcache.cpp
+++ b/src/network/access/qnetworkdiskcache.cpp
@@ -670,7 +670,7 @@ bool QCacheItem::read(QFileDevice *device, bool readData)
if (!device->fileName().endsWith(expectedFilename))
return false;
- return metaData.isValid();
+ return metaData.isValid() && !metaData.rawHeaders().isEmpty();
}
QT_END_NAMESPACE