Bug 143228 - Cached "Expires" header is not updated upon successful resource revalidation
Summary: Cached "Expires" header is not updated upon successful resource revalidation
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-03-30 10:31 PDT by Chris Dumez
Modified: 2015-03-30 15:47 PDT (History)
4 users (show)

See Also:


Attachments
Patch (8.35 KB, patch)
2015-03-30 14:25 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (8.99 KB, patch)
2015-03-30 15:29 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-30 10:31:47 PDT
Cached "Expires" header is not updated upon successful resource revalidation. This affects both our disk cache and our memory cache. This is because we shouldUpdateHeaderAfterRevalidation() in CacheValidation.cpp returns false for the "Expires" header.

HTTP servers such as Apache returns an "Expires" header in their 304 responses and the "Expires" header is potentially a new one. However, our caches ignore it and keep the old one, which means that the cached resource expires sooner than it should.

See the following Apache bugs that explain the issue:
https://bz.apache.org/bugzilla/show_bug.cgi?id=24884
https://bz.apache.org/bugzilla/show_bug.cgi?id=25123

There is a comment in the code that says the list of headers matches Chromium's net library but that's not the case, at least not anymore:
http://osxr.org/android/source/external/chromium/net/http/http_response_headers.cc
Comment 1 Radar WebKit Bug Importer 2015-03-30 10:32:38 PDT
<rdar://problem/20348059>
Comment 2 Antti Koivisto 2015-03-30 11:15:16 PDT
Good catch
Comment 3 Chris Dumez 2015-03-30 14:25:42 PDT
Created attachment 249761 [details]
Patch
Comment 4 Antti Koivisto 2015-03-30 15:15:17 PDT
Comment on attachment 249761 [details]
Patch

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

r=me, nice. We should also add some explicit Expires header tests at some point.

> LayoutTests/http/tests/cache/disk-cache/disk-cache-revalidation-new-expire-header-expected.txt:7
> +response headers: {"Expires":"now(0)","ETag":"match"}

Would be nice if this printed the expiresInFutureIn304 flag too. The suggestion below would cover that automatically.

> LayoutTests/http/tests/cache/disk-cache/disk-cache-revalidation-new-expire-header.html:8
> + { responseHeaders: {'Expires': 'now(0)', 'ETag': 'match' }, expiresInFutureIn304: true },

Another option would be to add another magical Expires value (nowButUpdateToFuture or something). Don't know if that is really any better.
Comment 5 Chris Dumez 2015-03-30 15:29:25 PDT
Created attachment 249773 [details]
Patch
Comment 6 WebKit Commit Bot 2015-03-30 15:47:52 PDT
Comment on attachment 249773 [details]
Patch

Clearing flags on attachment: 249773

Committed r182157: <http://trac.webkit.org/changeset/182157>
Comment 7 WebKit Commit Bot 2015-03-30 15:47:58 PDT
All reviewed patches have been landed.  Closing bug.