Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Unified Diff: content/browser/cache_storage/cache_storage_cache.cc

Issue 2204683002: Cache API should not match() HEAD requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: HEAD -> Head Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/cache_storage/cache_storage_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/cache_storage/cache_storage_cache.cc
diff --git a/content/browser/cache_storage/cache_storage_cache.cc b/content/browser/cache_storage/cache_storage_cache.cc
index caff0ac893174cb5b10631797e93c6197c343489..4cdae529e980460d059165a1745a7f85ef734ab2 100644
--- a/content/browser/cache_storage/cache_storage_cache.cc
+++ b/content/browser/cache_storage/cache_storage_cache.cc
@@ -596,6 +596,13 @@ void CacheStorageCache::QueryCache(
return;
}
+ if (!options.ignore_method && request && !request->method.empty() &&
+ request->method != "GET") {
+ callback.Run(CACHE_STORAGE_OK, base::MakeUnique<QueryCacheResults>(
+ std::move(request), options, callback));
+ return;
+ }
+
std::unique_ptr<QueryCacheResults> query_cache_results(
new QueryCacheResults(std::move(request), options, callback));
OpenAllEntries(base::Bind(&CacheStorageCache::QueryCacheDidOpenAllEntries,
@@ -702,6 +709,13 @@ void CacheStorageCache::MatchImpl(
return;
}
+ if (!request->method.empty() && request->method != "GET") {
+ callback.Run(CACHE_STORAGE_ERROR_NOT_FOUND,
+ std::unique_ptr<ServiceWorkerResponse>(),
+ std::unique_ptr<storage::BlobDataHandle>());
+ return;
+ }
+
std::unique_ptr<disk_cache::Entry*> scoped_entry_ptr(
new disk_cache::Entry*());
disk_cache::Entry** entry_ptr = scoped_entry_ptr.get();
« no previous file with comments | « no previous file | content/browser/cache_storage/cache_storage_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698