summaryrefslogtreecommitdiffstats
path: root/src/network/access/qnetworkaccesshttpbackend.cpp
diff options
context:
space:
mode:
authorRobert Hogan <robert@roberthogan.net>2010-11-01 13:01:22 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2010-11-01 13:04:02 (GMT)
commit809b4064580711b799314b42d38bc793f461cb83 (patch)
tree1571c0c9d35f2a1b82fbf474bbc0ed54f244db21 /src/network/access/qnetworkaccesshttpbackend.cpp
parentfdcb3fe188cca00b1d7f1eae82304d8cca549996 (diff)
downloadQt-809b4064580711b799314b42d38bc793f461cb83.zip
Qt-809b4064580711b799314b42d38bc793f461cb83.tar.gz
Qt-809b4064580711b799314b42d38bc793f461cb83.tar.bz2
QNAM HTTP: Do not set cache headers when already set by user
Qt clobbers the cache-control headers set by WebCore when CacheLoadControlAttribute == QNetworkRequest::AlwaysNetwork. This causes at least one QtWebKit layout test to fail: http/tests/misc/refresh-headers.php Qt needs to detect if the client has already made a cache-control decision in the headers before overwriting them. See https://bugs.webkit.org/show_bug.cgi?id=45598 Task-Number: QTBUG-13564 Merge-request: 2472 Reviewed-by: Markus Goetz <Markus.Goetz@nokia.com>
Diffstat (limited to 'src/network/access/qnetworkaccesshttpbackend.cpp')
-rw-r--r--src/network/access/qnetworkaccesshttpbackend.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp
index c02f30e2..0ae2192 100644
--- a/src/network/access/qnetworkaccesshttpbackend.cpp
+++ b/src/network/access/qnetworkaccesshttpbackend.cpp
@@ -349,10 +349,12 @@ void QNetworkAccessHttpBackend::validateCache(QHttpNetworkRequest &httpRequest,
QNetworkRequest::CacheLoadControl CacheLoadControlAttribute =
(QNetworkRequest::CacheLoadControl)request().attribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork).toInt();
if (CacheLoadControlAttribute == QNetworkRequest::AlwaysNetwork) {
- // forced reload from the network
- // tell any caching proxy servers to reload too
- httpRequest.setHeaderField("Cache-Control", "no-cache");
- httpRequest.setHeaderField("Pragma", "no-cache");
+ // If the request does not already specify preferred cache-control
+ // force reload from the network and tell any caching proxy servers to reload too
+ if (!request().rawHeaderList().contains("Cache-Control")) {
+ httpRequest.setHeaderField("Cache-Control", "no-cache");
+ httpRequest.setHeaderField("Pragma", "no-cache");
+ }
return;
}