Responses to request with AlwaysNetwork set should be cached

Previously the cache was not enabled if the request had AlwaysNetwork
set. This removes the check for the CacheLoadControlAttribute when
checking if the cache should be enabled.

Task-number: QTBUG-15805
Change-Id: I3d0722fbc1e6c77c5b947a2af0a09e2de8f4f9df
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
This commit is contained in:
Martin Petersson 2012-04-16 12:41:42 +02:00 committed by Qt by Nokia
parent 2b1e0940fd
commit 0a5440b2f0
2 changed files with 2 additions and 8 deletions

View File

@ -1945,10 +1945,7 @@ void QNetworkReplyHttpImplPrivate::createCache()
{
// check if we can save and if we're allowed to
if (!managerPrivate->networkCache
|| !request.attribute(QNetworkRequest::CacheSaveControlAttribute, true).toBool()
|| request.attribute(QNetworkRequest::CacheLoadControlAttribute,
QNetworkRequest::PreferNetwork).toInt()
== QNetworkRequest::AlwaysNetwork)
|| !request.attribute(QNetworkRequest::CacheSaveControlAttribute, true).toBool())
return;
cacheEnabled = true;
}

View File

@ -451,10 +451,7 @@ void QNetworkReplyImplPrivate::createCache()
{
// check if we can save and if we're allowed to
if (!networkCache()
|| !request.attribute(QNetworkRequest::CacheSaveControlAttribute, true).toBool()
|| request.attribute(QNetworkRequest::CacheLoadControlAttribute,
QNetworkRequest::PreferNetwork).toInt()
== QNetworkRequest::AlwaysNetwork)
|| !request.attribute(QNetworkRequest::CacheSaveControlAttribute, true).toBool())
return;
cacheEnabled = true;
}