Bug 13309

Summary: [S60] BrowserCache not calculating current Age correctly
Product: WebKit Reporter: Anand Patil <anand.1.patil>
Component: WebKit Misc.Assignee: Nobody <webkit-unassigned>
Status: CLOSED INVALID    
Severity: Major CC: bradley.morrison, webkit
Priority: P4    
Version: 523.x (Safari 3)   
Hardware: PC   
OS: S60 3rd edition   
URL: http://www.barnesandnoble.com
Attachments:
Description Flags
More information is in the attached 'browser_cache_age_calc_error.doc'.
none
Fix for HTTP cache Age calculation Sachin.Padma: review-

Description Anand Patil 2007-04-09 04:06:21 PDT
More information is in the attached 'browser_cache_age_calc_error.doc'.

- Use case:

Cache is empty. Download a webpage. Stale HTTP::Date response headers cause the objects to be revalidated when it need not be. 

- Steps to reproduce:

- Actual outcome:

RFC 2616, Section 13.2.3 Age Calculation defines the following algorithm and variables for currentAge calculations. Not that the request_time and response_time are locally computed values when the item is cached. 

/*
* age_value
* is the value of Age: header received by the cache with
* this response.
* date_value
* is the value of the origin server's Date: header
* request_time
* is the (local) time when the cache made the request
* that resulted in this cached response
* response_time
* is the (local) time when the cache received the
* response
* now
* is the current (local) time
*/
apparent_age = max(0, response_time - date_value);
corrected_received_age = max(apparent_age, age_value);
response_delay = response_time - request_time;
corrected_initial_age = corrected_received_age + response_delay;
resident_time = now - response_time;
current_age = corrected_initial_age + resident_time;

A problem is that the request_time and response_time variables must be locally computed and not be the values received in the HTTP::Date header. By using the HTTP::Date header values, it causes the above resident_time variable to be extremely large and causing the current_age to exceed the Cache-Control: max-age header value. 

The BrowserCache is incorrectly relying on the HTTP response header HTTP::Date field in order to calculate the value of the below mentioned ‘request_time’ and ‘response_time’. Those variables need to be locally computed as described in RFC 2616, section 13.2.3.

 This causes a revalidation and the HTTP request has to be sent over the wire again. This can cause a performance drop in page load times. 

- Expected outcome:

The BrowserCache is incorrectly relying on the HTTP response header HTTP::Date field in order to calculate the value of the  ‘request_time’ and ‘response_time’. Those variables need to be locally computed as described in RFC 2616, section 13.2.3.

This should result in no need to revalidate the cached object.
Comment 1 Anand Patil 2007-04-09 04:09:21 PDT
Created attachment 13990 [details]
More information is in the attached 'browser_cache_age_calc_error.doc'.
Comment 2 Anand Patil 2007-04-09 04:10:28 PDT
Created attachment 13991 [details]
Fix for HTTP cache Age calculation
Comment 3 Sachin Padma 2007-04-09 08:00:15 PDT
Comment on attachment 13991 [details]
Fix for HTTP cache Age calculation

This would cause the request time to be the time when resource is requested from cache everytime and not when it was actually first requested
Comment 4 Robert Blaut 2008-06-11 00:24:07 PDT
I think the S60 platform bug should be closed as other S60 bugs.
Comment 5 Joel Parks 2011-03-21 11:53:22 PDT
re-purposing InTSW keyword for use by QtWebkit team