[WK2] We should not even try the network cache for non-HTTP protocol requests
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Mar 2015 07:26:27 +0000 (07:26 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Mar 2015 07:26:27 +0000 (07:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=142802
<rdar://problem/19632130>

Reviewed by Antti Koivisto.

We should not even try the network cache for non-HTTP protocol requests
and the network cache cannot handle those.

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::start):
* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::canRetrieve):
(WebKit::NetworkCache::Cache::retrieve):
* NetworkProcess/cache/NetworkCache.h:
* NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm:
(WebKit::NetworkCache::retrieveDecisionToDiagnosticKey):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181688 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp
Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp
Source/WebKit2/NetworkProcess/cache/NetworkCache.h
Source/WebKit2/NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm

index 111791c..825fb46 100644 (file)
@@ -1,3 +1,23 @@
+2015-03-18  Chris Dumez  <cdumez@apple.com>
+
+        [WK2] We should not even try the network cache for non-HTTP protocol requests
+        https://bugs.webkit.org/show_bug.cgi?id=142802
+        <rdar://problem/19632130>
+
+        Reviewed by Antti Koivisto.
+
+        We should not even try the network cache for non-HTTP protocol requests
+        and the network cache cannot handle those.
+
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::NetworkResourceLoader::start):
+        * NetworkProcess/cache/NetworkCache.cpp:
+        (WebKit::NetworkCache::canRetrieve):
+        (WebKit::NetworkCache::Cache::retrieve):
+        * NetworkProcess/cache/NetworkCache.h:
+        * NetworkProcess/cache/NetworkCacheStatisticsCocoa.mm:
+        (WebKit::NetworkCache::retrieveDecisionToDiagnosticKey):
+
 2015-03-17  Conrad Shultz  <conrad_shultz@apple.com>
 
         Ignore some deprecation warnings
index 2b03e38..e1c9a57 100644 (file)
@@ -135,7 +135,7 @@ void NetworkResourceLoader::start()
     m_currentRequest = originalRequest();
 
 #if ENABLE(NETWORK_CACHE)
-    if (!NetworkCache::singleton().isEnabled() || sessionID().isEphemeral()) {
+    if (!NetworkCache::singleton().isEnabled() || sessionID().isEphemeral() || !originalRequest().url().protocolIsInHTTPFamily()) {
         startNetworkLoad();
         return;
     }
index 571641e..b2f3661 100644 (file)
@@ -244,8 +244,6 @@ static std::unique_ptr<Entry> decodeStorageEntry(const Storage::Entry& storageEn
 
 static RetrieveDecision canRetrieve(const WebCore::ResourceRequest& request)
 {
-    if (!request.url().protocolIsInHTTPFamily())
-        return RetrieveDecision::NoDueToProtocol;
     // FIXME: Support HEAD and OPTIONS requests.
     if (request.httpMethod() != "GET")
         return RetrieveDecision::NoDueToHTTPMethod;
@@ -261,6 +259,7 @@ static RetrieveDecision canRetrieve(const WebCore::ResourceRequest& request)
 void Cache::retrieve(const WebCore::ResourceRequest& originalRequest, uint64_t webPageID, std::function<void (std::unique_ptr<Entry>)> completionHandler)
 {
     ASSERT(isEnabled());
+    ASSERT(originalRequest.url().protocolIsInHTTPFamily());
 
     LOG(NetworkCache, "(NetworkProcess) retrieving %s priority %u", originalRequest.url().string().ascii().data(), originalRequest.priority());
 
index 99a4ccf..38496d9 100644 (file)
@@ -66,7 +66,6 @@ struct Entry {
 
 enum class RetrieveDecision {
     Yes,
-    NoDueToProtocol,
     NoDueToHTTPMethod,
     NoDueToConditionalRequest,
     NoDueToReloadIgnoringCache
index b3842e7..74f6e8f 100644 (file)
@@ -190,8 +190,6 @@ void Statistics::recordNotCachingResponse(const Key& key, StoreDecision storeDec
 static String retrieveDecisionToDiagnosticKey(RetrieveDecision retrieveDecision)
 {
     switch (retrieveDecision) {
-    case RetrieveDecision::NoDueToProtocol:
-        return WebCore::DiagnosticLoggingKeys::notHTTPFamilyKey();
     case RetrieveDecision::NoDueToHTTPMethod:
         return WebCore::DiagnosticLoggingKeys::unsupportedHTTPMethodKey();
     case RetrieveDecision::NoDueToConditionalRequest: