diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2009-07-15 14:56:57 +0200 |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2009-07-21 12:07:07 +0200 |
commit | 42e469bc5edcc6dee2401a104bd30de6b4be54fe (patch) | |
tree | caa9acef985e50c8fd4a2c7f52ed7a1977bc3d6b /src/network/access/qnetworkaccesscachebackend.cpp | |
parent | 08834e4f7af8c1a4fe34ccfbbb8d2c973e91eb48 (diff) | |
download | qt4-tools-42e469bc5edcc6dee2401a104bd30de6b4be54fe.tar.gz |
QNAM: Proper loading of meta data when having AlwaysCache mode
Properly load the raw headers and properly handle the redirection
when having a network cache in AlwaysCache mode (equals the offline
mode in web browser).
Task-number: 256240
Reviewed-by: Thiago Macieira
Diffstat (limited to 'src/network/access/qnetworkaccesscachebackend.cpp')
-rw-r--r-- | src/network/access/qnetworkaccesscachebackend.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/network/access/qnetworkaccesscachebackend.cpp b/src/network/access/qnetworkaccesscachebackend.cpp index f46a50a449..8571ba32a5 100644 --- a/src/network/access/qnetworkaccesscachebackend.cpp +++ b/src/network/access/qnetworkaccesscachebackend.cpp @@ -86,6 +86,20 @@ bool QNetworkAccessCacheBackend::sendCacheContents() setAttribute(QNetworkRequest::HttpReasonPhraseAttribute, attributes.value(QNetworkRequest::HttpReasonPhraseAttribute)); setAttribute(QNetworkRequest::SourceIsFromCacheAttribute, true); + // set the raw headers + QNetworkCacheMetaData::RawHeaderList rawHeaders = item.rawHeaders(); + QNetworkCacheMetaData::RawHeaderList::ConstIterator it = rawHeaders.constBegin(), + end = rawHeaders.constEnd(); + for ( ; it != end; ++it) + setRawHeader(it->first, it->second); + + // handle a possible redirect + QVariant redirectionTarget = attributes.value(QNetworkRequest::RedirectionTargetAttribute); + if (redirectionTarget.isValid()) { + setAttribute(QNetworkRequest::RedirectionTargetAttribute, redirectionTarget); + redirectionRequested(redirectionTarget.toUrl()); + } + // signal we're open metaDataChanged(); |