summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Hartmann <peter.hartmann@nokia.com>2011-05-04 11:47:06 (GMT)
committerPeter Hartmann <peter.hartmann@nokia.com>2011-05-04 12:04:11 (GMT)
commit0e449f38894b1bd2dbb2f14206a011424679f063 (patch)
tree78c80f518bcca176f957d27a402ad3231091948b
parent154ab1cb4c4cdf34f21fc93b078f91cc79048bd4 (diff)
downloadQt-0e449f38894b1bd2dbb2f14206a011424679f063.zip
Qt-0e449f38894b1bd2dbb2f14206a011424679f063.tar.gz
Qt-0e449f38894b1bd2dbb2f14206a011424679f063.tar.bz2
HTTP backend: 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
-rw-r--r--src/network/access/qnetworkaccesshttpbackend.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp
index c619114..a45c2de 100644
--- a/src/network/access/qnetworkaccesshttpbackend.cpp
+++ b/src/network/access/qnetworkaccesshttpbackend.cpp
@@ -262,13 +262,11 @@ bool QNetworkAccessHttpBackend::loadFromCacheIfAllowed(QHttpNetworkRequest &http
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();