diff options
author | Robert Hogan <robert@roberthogan.net> | 2010-11-01 13:01:22 (GMT) |
---|---|---|
committer | Qt Commercial Integration <QtCommercial@digia.com> | 2012-01-31 10:24:47 (GMT) |
commit | d5560e2cc3271138cf977ebd83f346a375278fd8 (patch) | |
tree | 8fb080c6f7f907ae0c0b217389543874d54dea69 | |
parent | 68f5137da595dd8e1623568ac7ccd71c0f0701fb (diff) | |
download | Qt-d5560e2cc3271138cf977ebd83f346a375278fd8.zip Qt-d5560e2cc3271138cf977ebd83f346a375278fd8.tar.gz Qt-d5560e2cc3271138cf977ebd83f346a375278fd8.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>
-rw-r--r-- | src/network/access/qnetworkaccesshttpbackend.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index 42dc33d..1d85f3a 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -353,10 +353,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; } |