Bug 83925

Summary: REGRESSION (XHR Caching): Uncacheable responses sent by Rails through Apache are cached
Product: WebKit Reporter: Alexey Proskuryakov <ap>
Component: Page LoadingAssignee: Alexey Proskuryakov <ap>
Status: RESOLVED FIXED    
Severity: Normal CC: japhet, koivisto
Priority: P1 Keywords: InRadar, Regression
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
proposed fix koivisto: review+

Description Alexey Proskuryakov 2012-04-13 11:46:14 PDT
When using Rails with Apache, it's common to have two max-age directives (one is added by Rails, another by mod_expires):

max-age=0, private, must-revalidate, max-age=60

We appear to honor the last directive instead of the first,like other browsers do.

Steps to reproduce:
1. Terminal: sudo gem install sinatra
2. Download and unzip the attached archive.
3. In Terminal, cd to the archive's directory and run 'ruby app.rb'
4. In Safari, open a new window and navigate to http://localhost:4567
5. Click the button on the page and observe the output from the ruby command above.

I confirmed that this test started to fail in r107672, although the root cause is really a pre-existing issue with memory cache (the same is reproducible with script elements).

Nate, is this something you'd be willing to look into?

<rdar://problem/11231790>
Comment 1 Nate Chapin 2012-04-13 11:51:58 PDT
I'd be happy to. Fair warning though, I don't know all that much about the part of the cache that actually handles caching headers, so I may be slow to figure it out.
Comment 2 Alexey Proskuryakov 2012-04-13 13:36:51 PDT
Actually, this might be as easy as adjusting precedence in ResourceResponseBase::parseCacheControlDirectives(). I'll take a look.
Comment 3 Alexey Proskuryakov 2012-04-13 13:54:32 PDT
Created attachment 137141 [details]
proposed fix
Comment 4 Antti Koivisto 2012-04-13 13:55:56 PDT
Comment on attachment 137141 [details]
proposed fix

r=me
Comment 5 Alexey Proskuryakov 2012-04-13 13:58:09 PDT
Committed <http://trac.webkit.org/changeset/114165>.