Closed
Bug 669001
Opened 13 years ago
Closed 13 years ago
Vary: User-Agent + new UA string (i.e. after update) + HTTP 304 = broken cache
Categories
(Core :: Networking: Cache, defect)
Tracking
()
RESOLVED
FIXED
mozilla11
People
(Reporter: bugzilla1, Assigned: mayhemer)
Details
Attachments
(1 file, 1 obsolete file)
5.41 KB,
patch
|
mayhemer
:
review+
|
Details | Diff | Splinter Review |
For resources that use Vary: User-Agent, the cache stores the UA string that was used in the initial request. When a request is made for that same resource but the UA string has changed since the initial request, Gecko will validate the previously cached data using If-None-Match.
That's fine, except when the server replies with a 304, the cache is apparently not updated with the new UA string and consequently the resource will be continue to be revalidated every single time the browser asks for it which renders the cache largely useless (particularly on a high-latency connection).
STR:
0) Enable HTTP logger of your choice
1) Visit www.pre-school.org.uk
2) Click Home. Again. And Again.
3) Note that the only resource fetched from those clicks is the page itself
4) Change your UA string (e.g. upgrade to new build, or fiddle with about:config)
5) Repeat steps (1) and (2)
6) Note that in addition to the page, requests for the CSS and JS are issued every time.
7) Downgrade to previous build, or revert about:config changes
8) Repeat steps (1) and (2)
9) Note that cache behaves again, and requests for the CSS and JS are not issued.
Comment 1•13 years ago
|
||
Honza, can you take a look please?
Assignee | ||
Comment 2•13 years ago
|
||
According to RFC 2616, section 13.6: "If the entity-tag of the new response matches that of an existing entry, the new response SHOULD be used to update the header fields of the existing entry, and the result MUST be returned to the client." This applies to 304 responses.
Code that does this update is in nsHttpChannel::AddCacheEntryHeaders. We seems to lack call to that method from nsHttpChannel::ProcessNotModified. The patch adds it, and this also fixes this bug.
Only disadvantage is that we overwrite the response head in cache with the cached one - i.e. identical one (a bit wasting).
Assignee | ||
Comment 3•13 years ago
|
||
And yes, we should have a test as well. And I will also push this to try.
Assignee | ||
Comment 4•13 years ago
|
||
Try is green: http://tbpl.mozilla.org/?tree=Try&rev=8aad3b30b3cb
Comment 5•13 years ago
|
||
Comment on attachment 543762 [details] [diff] [review]
v1
Please add a test.
r=me with that.
Attachment #543762 -
Flags: review?(bzbarsky) → review+
Reporter | ||
Comment 6•13 years ago
|
||
If a test is really tricky, can the patch get checked in anyway in the meantime?
Assignee | ||
Comment 7•13 years ago
|
||
The test is probably not that tricky, just no time to write it now. Anyway, I think it is too late, we have some 4 days to merge to aurora. I don't think we want to take this change w/o proper testing on the trunk first.
Assignee | ||
Comment 8•13 years ago
|
||
Ready to land
Attachment #543762 -
Attachment is obsolete: true
Attachment #566591 -
Flags: review+
Assignee | ||
Comment 9•13 years ago
|
||
Comment 10•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla11
You need to log in
before you can comment on or make changes to this bug.
Description
•