Title: [181904] trunk
- Revision
- 181904
- Author
- [email protected]
- Date
- 2015-03-24 13:42:20 -0700 (Tue, 24 Mar 2015)
Log Message
[WK2] Responses with 404 HTTP Status Code should be cacheable by default
https://bugs.webkit.org/show_bug.cgi?id=143014
<rdar://problem/20280310>
Reviewed by Antti Koivisto.
Source/WebKit2:
Make responses with 404 HTTP Status Code cacheable by default, as
per RFC 7231:
http://tools.ietf.org/html/rfc7231#section-6.5.4
Test: http/tests/cache/disk-cache/disk-cache-404-status-code.html
* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::canStore):
LayoutTests:
Add test to make sure that responses with 404 HTTP Status Code are
cacheable by default.
* http/tests/cache/disk-cache/disk-cache-404-status-code-expected.txt: Added.
* http/tests/cache/disk-cache/disk-cache-404-status-code.html: Added.
* http/tests/cache/disk-cache/resources/generate-response.cgi:
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (181903 => 181904)
--- trunk/LayoutTests/ChangeLog 2015-03-24 20:41:47 UTC (rev 181903)
+++ trunk/LayoutTests/ChangeLog 2015-03-24 20:42:20 UTC (rev 181904)
@@ -1,3 +1,18 @@
+2015-03-24 Chris Dumez <[email protected]>
+
+ [WK2] Responses with 404 HTTP Status Code should be cacheable by default
+ https://bugs.webkit.org/show_bug.cgi?id=143014
+ <rdar://problem/20280310>
+
+ Reviewed by Antti Koivisto.
+
+ Add test to make sure that responses with 404 HTTP Status Code are
+ cacheable by default.
+
+ * http/tests/cache/disk-cache/disk-cache-404-status-code-expected.txt: Added.
+ * http/tests/cache/disk-cache/disk-cache-404-status-code.html: Added.
+ * http/tests/cache/disk-cache/resources/generate-response.cgi:
+
2015-03-24 Joseph Pecoraro <[email protected]>
ES6: Object Literal Methods toString is missing method name
Added: trunk/LayoutTests/http/tests/cache/disk-cache/disk-cache-404-status-code-expected.txt (0 => 181904)
--- trunk/LayoutTests/http/tests/cache/disk-cache/disk-cache-404-status-code-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/cache/disk-cache/disk-cache-404-status-code-expected.txt 2015-03-24 20:42:20 UTC (rev 181904)
@@ -0,0 +1,17 @@
+Test that responses with HTTP status code 404 are cacheable
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+running 2 tests
+
+response headers: {"Status":"404","Cache-control":"max-age=0"}
+response source: Network
+
+response headers: {"Status":"404","Cache-control":"max-age=100"}
+response source: Disk cache
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/http/tests/cache/disk-cache/disk-cache-404-status-code.html (0 => 181904)
--- trunk/LayoutTests/http/tests/cache/disk-cache/disk-cache-404-status-code.html (rev 0)
+++ trunk/LayoutTests/http/tests/cache/disk-cache/disk-cache-404-status-code.html 2015-03-24 20:42:20 UTC (rev 181904)
@@ -0,0 +1,20 @@
+<script src=""
+<script src=""
+<body>
+<script>
+
+var tests =
+[
+ { responseHeaders: {'Status': '404', 'Cache-control': 'max-age=0' } },
+ { responseHeaders: {'Status': '404', 'Cache-control': 'max-age=100' } },
+];
+
+description("Test that responses with HTTP status code 404 are cacheable");
+
+debug("running " + tests.length + " tests");
+debug("");
+
+runTests(tests);
+
+</script>
+<script src=""
Modified: trunk/LayoutTests/http/tests/cache/disk-cache/resources/generate-response.cgi (181903 => 181904)
--- trunk/LayoutTests/http/tests/cache/disk-cache/resources/generate-response.cgi 2015-03-24 20:41:47 UTC (rev 181903)
+++ trunk/LayoutTests/http/tests/cache/disk-cache/resources/generate-response.cgi 2015-03-24 20:42:20 UTC (rev 181904)
@@ -6,12 +6,15 @@
my $query = new CGI;
@names = $query->param;
+my $hasStatusCode = 0;
if ($query->http && $query->http("If-None-Match") eq "match") {
print "Status: 304\n";
+ $hasStatusCode = 1;
}
foreach (@names) {
next if ($_ eq "uniqueId");
+ next if ($_ eq "Status" and $hasStatusCode);
print $_ . ": " . $query->param($_) . "\n";
}
print "\n";
Modified: trunk/Source/WebKit2/ChangeLog (181903 => 181904)
--- trunk/Source/WebKit2/ChangeLog 2015-03-24 20:41:47 UTC (rev 181903)
+++ trunk/Source/WebKit2/ChangeLog 2015-03-24 20:42:20 UTC (rev 181904)
@@ -1,5 +1,22 @@
2015-03-24 Chris Dumez <[email protected]>
+ [WK2] Responses with 404 HTTP Status Code should be cacheable by default
+ https://bugs.webkit.org/show_bug.cgi?id=143014
+ <rdar://problem/20280310>
+
+ Reviewed by Antti Koivisto.
+
+ Make responses with 404 HTTP Status Code cacheable by default, as
+ per RFC 7231:
+ http://tools.ietf.org/html/rfc7231#section-6.5.4
+
+ Test: http/tests/cache/disk-cache/disk-cache-404-status-code.html
+
+ * NetworkProcess/cache/NetworkCache.cpp:
+ (WebKit::NetworkCache::canStore):
+
+2015-03-24 Chris Dumez <[email protected]>
+
[WK2] Remove NetworkCache FIXME comment about caching responses to OPTIONS requests
https://bugs.webkit.org/show_bug.cgi?id=143009
Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp (181903 => 181904)
--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp 2015-03-24 20:41:47 UTC (rev 181903)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp 2015-03-24 20:42:20 UTC (rev 181904)
@@ -325,6 +325,7 @@
case 301: // Moved Permanently
case 302: // Found
case 307: // Temporary Redirect
+ case 404: // Not Found
case 410: // Gone
if (response.cacheControlContainsNoStore()) {
LOG(NetworkCache, "(NetworkProcess) Cache-control:no-store");
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes