Bug 143014 - [WK2] Responses with 404 HTTP Status Code should be cacheable by default
Summary: [WK2] Responses with 404 HTTP Status Code should be cacheable by default
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: http://tools.ietf.org/html/rfc7231#se...
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-03-24 13:18 PDT by Chris Dumez
Modified: 2015-03-24 13:43 PDT (History)
4 users (show)

See Also:


Attachments
Patch (5.20 KB, patch)
2015-03-24 13:27 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (5.14 KB, patch)
2015-03-24 13:39 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2015-03-24 13:18:38 PDT
Responses with 404 HTTP Status Code should be cacheable by default according to RFC 7231:
"""
   A 404 response is cacheable by default; i.e., unless otherwise
   indicated by the method definition or explicit cache controls (see
   Section 4.2.2 of [RFC7234]).
""" [1]

[1] http://tools.ietf.org/html/rfc7231#section-6.5.4

The new WebKit Network cache does not currently cache these, even if Cache-Control headers allow us to do so.
Comment 1 Radar WebKit Bug Importer 2015-03-24 13:19:28 PDT
<rdar://problem/20280310>
Comment 2 Chris Dumez 2015-03-24 13:27:05 PDT
Created attachment 249343 [details]
Patch
Comment 3 Antti Koivisto 2015-03-24 13:35:42 PDT
Comment on attachment 249343 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=249343&action=review

> LayoutTests/http/tests/cache/disk-cache/disk-cache-404-status-code.html:21
> +var testMatrix =
> +[
> + [
> +  { 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");
> +
> +var tests = generateTests(testMatrix);
> +
> +debug("running " + tests.length + " tests");
> +debug("");
> +
> +runTests(tests);

If you don't need permutations you can just define the tests as simple array and call runTests directly.
Comment 4 Chris Dumez 2015-03-24 13:39:49 PDT
Created attachment 249347 [details]
Patch
Comment 5 Chris Dumez 2015-03-24 13:43:01 PDT
Comment on attachment 249347 [details]
Patch

Clearing flags on attachment: 249347

Committed r181904: <http://trac.webkit.org/changeset/181904>
Comment 6 Chris Dumez 2015-03-24 13:43:18 PDT
All reviewed patches have been landed.  Closing bug.