Responses to request with AlwaysNetwork set should be cached
authorMartin Petersson <Martin.Petersson@nokia.com>
Mon, 16 Apr 2012 10:41:42 +0000 (12:41 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 16 Apr 2012 16:35:58 +0000 (18:35 +0200)
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>
src/network/access/qnetworkreplyhttpimpl.cpp
src/network/access/qnetworkreplyimpl.cpp

index 101e1aa..7977704 100644 (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;
 }
index c0b8acc..3ab8464 100644 (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;
 }