Closed Bug 322851 Opened 19 years ago Closed 8 years ago

link rel="next" does not send If-Modified-Since headers

Categories

(Core :: Networking, defect)

1.8 Branch
x86
Windows Server 2003
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: ravenousbugblatterbeast, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8) Gecko/20051111 Firefox/1.5

If a page includes a <link rel="next" href="http://somewhere.com"> tag Firefox will prefetch the content of that page.

However, if the prefetched page returns a "Cache-Control: no-cache, max-age=0" header and a "Last-Modified" header, Firefox will download the prefetched content again when the use actually navigates to the page, and will not send an "If-Modified-Since" header. Re-fetching the content makes sense as the cache control header has indicated it has expired, but an If-Modified-Since should also be sent as Firefox should still have a copy of the pre-fetched content.



Reproducible: Always

Steps to Reproduce:
1. Create two pages, the first with a <link rel="next tag and a link to the 2nd page.

2. Have the 2nd page return HTML content with headers:

Cache-Control: no-cache,max-age=0
Last-Modified: Sun, 01 Jan 2006 00:00:00 GMT

Also have this page dump the request headers it receives into the output

3. Visit the first page and follow the link to the second page


4. 

Actual Results:  
The request headers do not include an If-Modified-Since header


Expected Results:  
The request headers should have included:

If-Modified-Since: Sun, 01 Jan 2006 00:00:00 GMT

This is different behavior to when the user actually browses to the page sending the no-cache and last-modified headers, navigates to another page and then navigates back again. In this situation although the page specifies no-cache Firefox still has a copy in memory so correctly sends the If-Modified-Since header.

Not sending an If-Modified-Since makes prefetching a hinderence rather than a help as it increases the load on the server and offers no benefit to the client.
Assignee: nobody → darin
Component: General → Networking
Product: Firefox → Core
QA Contact: general → benc
Version: unspecified → 1.8 Branch
On further investigation, in order to generate an If-Modified-Since header I have to:

a) Set Cache-Control header to private rather than no-cache
b) Send an Expires header with a date at least 1 second in the future (future being calculated using the client's clock, not the server's)

Firefox does not take into account the clock skew difference in the Date header of the response and the local machine's clock to shift the expiry date by the same amount (I'm not sure if its supposed to), therefore in the real world where the client and server are on different machines, it would have to be more than 1 second in the future.

Sending a max-age=1 or an smax-age=1 in the cache control instead of an expiry header, or an expiry header in the past does not cause an If-Modified-Since header to be sent.
Assignee: darin → nobody
QA Contact: benc → networking
I can no longer repeat this in build 2006080305. I believe the patch from bug 335909 may have resolved things.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.