diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2009-07-15 12:56:57 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2009-07-21 10:07:07 (GMT) |
commit | 42e469bc5edcc6dee2401a104bd30de6b4be54fe (patch) | |
tree | caa9acef985e50c8fd4a2c7f52ed7a1977bc3d6b /src/network/access/qnetworkreplyimpl.cpp | |
parent | 08834e4f7af8c1a4fe34ccfbbb8d2c973e91eb48 (diff) | |
download | Qt-42e469bc5edcc6dee2401a104bd30de6b4be54fe.zip Qt-42e469bc5edcc6dee2401a104bd30de6b4be54fe.tar.gz Qt-42e469bc5edcc6dee2401a104bd30de6b4be54fe.tar.bz2 |
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/qnetworkreplyimpl.cpp')
-rw-r--r-- | src/network/access/qnetworkreplyimpl.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 98944fd..4ec3a75 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -376,7 +376,17 @@ void QNetworkReplyImplPrivate::feed(const QByteArray &data) QNetworkCacheMetaData metaData; metaData.setUrl(url); metaData = backend->fetchCacheMetaData(metaData); + + // save the redirect request also in the cache + QVariant redirectionTarget = q->attribute(QNetworkRequest::RedirectionTargetAttribute); + if (redirectionTarget.isValid()) { + QNetworkCacheMetaData::AttributesMap attributes = metaData.attributes(); + attributes.insert(QNetworkRequest::RedirectionTargetAttribute, redirectionTarget); + metaData.setAttributes(attributes); + } + cacheSaveDevice = networkCache->prepare(metaData); + if (!cacheSaveDevice || (cacheSaveDevice && !cacheSaveDevice->isOpen())) { if (cacheSaveDevice && !cacheSaveDevice->isOpen()) qCritical("QNetworkReplyImpl: network cache returned a device that is not open -- " |