diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-01-11 09:26:34 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-01-11 09:26:34 (GMT) |
commit | 9a820c4219c67aa401f0ac99d7bcc966c249d637 (patch) | |
tree | 20d7b9b9ebac7b3b15878fef0f038d3cb0741ca2 /src | |
parent | f19a82bc9da149fc776f9dbcb081d4cf7f3b570a (diff) | |
download | Qt-9a820c4219c67aa401f0ac99d7bcc966c249d637.zip Qt-9a820c4219c67aa401f0ac99d7bcc966c249d637.tar.gz Qt-9a820c4219c67aa401f0ac99d7bcc966c249d637.tar.bz2 |
Fix regression introduced in e49aee9f: set If-Modified-Since.
I moved the code above the other tests because it's more complex. But,
of course, that's wrong because it returns without setting the
necessary headers.
Reviewed-by: Peter Hartmann
Diffstat (limited to 'src')
-rw-r--r-- | src/network/access/qnetworkaccesshttpbackend.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index 12b10f9..5a2cce4 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -385,6 +385,14 @@ void QNetworkAccessHttpBackend::validateCache(QHttpNetworkRequest &httpRequest, QNetworkHeadersPrivate::RawHeadersList::ConstIterator it; cacheHeaders.setAllRawHeaders(metaData.rawHeaders()); + it = cacheHeaders.findRawHeader("etag"); + if (it != cacheHeaders.rawHeaders.constEnd()) + httpRequest.setHeaderField("If-None-Match", it->second); + + QDateTime lastModified = metaData.lastModified(); + 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()) { @@ -394,14 +402,6 @@ void QNetworkAccessHttpBackend::validateCache(QHttpNetworkRequest &httpRequest, } } - it = cacheHeaders.findRawHeader("etag"); - if (it != cacheHeaders.rawHeaders.constEnd()) - httpRequest.setHeaderField("If-None-Match", it->second); - - QDateTime lastModified = metaData.lastModified(); - if (lastModified.isValid()) - httpRequest.setHeaderField("If-Modified-Since", QNetworkHeadersPrivate::toHttpDate(lastModified)); - QDateTime currentDateTime = QDateTime::currentDateTime(); QDateTime expirationDate = metaData.expirationDate(); |