diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2023-03-03 19:08:23 +0100 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2023-03-09 15:24:45 +0000 |
commit | a6776de0c70d23ac197682c7bef603450cb8b03f (patch) | |
tree | bcf13f558c4e986a714cb62454c59e3cf0fc04ca /src/network/access/qnetworkdiskcache.cpp | |
parent | e5f295c8a458dcd336f7cf3768ca62aded69e659 (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
Pick-to: 6.5 6.4 6.2
Change-Id: Ie40149ffdaff7886bcd44cbd45605bdb7918e105
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network/access/qnetworkdiskcache.cpp')
-rw-r--r-- | src/network/access/qnetworkdiskcache.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index 3c44da5b69..0b0db2d3a1 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -677,7 +677,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 |