diff options
author | Peter Hartmann <peter.hartmann@nokia.com> | 2011-05-04 14:33:21 +0200 |
---|---|---|
committer | Peter Hartmann <peter.hartmann@nokia.com> | 2011-05-04 14:34:34 +0200 |
commit | 0c9f327102d30fa3b37559469445da6f7de1f6ff (patch) | |
tree | 4bed66887844bb84d81696e319725b57cd3ea471 /src/network/access | |
parent | 863de43dcad501a6c9675823217d0abf0269f802 (diff) |
HTTP reply: do not load resources from cache that must be revalidated
The header field "Cache-Control: must-revalidate" is a strict
requirement for loading the resource from the server, and not reading it
from the cache without revalidating first. With this patch, PreferCache
will load such from the network instead of loading them from the cache,
and AlwaysCache will throw a ContentNotFound error.
Reviewed-by: Markus Goetz
Task-number: QTBUG-18983
Diffstat (limited to 'src/network/access')
-rw-r--r-- | src/network/access/qnetworkreplyhttpimpl.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 4b5d310cf0..cd6d8fb87e 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -500,13 +500,11 @@ bool QNetworkReplyHttpImplPrivate::loadFromCacheIfAllowed(QHttpNetworkRequest &h if (lastModified.isValid()) httpRequest.setHeaderField("If-Modified-Since", QNetworkHeadersPrivate::toHttpDate(lastModified)); - if (CacheLoadControlAttribute == QNetworkRequest::PreferNetwork) { - it = cacheHeaders.findRawHeader("Cache-Control"); - if (it != cacheHeaders.rawHeaders.constEnd()) { - QHash<QByteArray, QByteArray> cacheControl = parseHttpOptionHeader(it->second); - if (cacheControl.contains("must-revalidate")) - return false; - } + it = cacheHeaders.findRawHeader("Cache-Control"); + if (it != cacheHeaders.rawHeaders.constEnd()) { + QHash<QByteArray, QByteArray> cacheControl = parseHttpOptionHeader(it->second); + if (cacheControl.contains("must-revalidate")) + return false; } QDateTime currentDateTime = QDateTime::currentDateTime(); |