- From: Julian Reschke <julian.reschke@gmx.de>
- Date: Wed, 10 Mar 2010 09:50:38 +0100
- To: Mark Nottingham <mnot@mnot.net>
- CC: HTTP Working Group <ietf-http-wg@w3.org>
On 09.03.2010 23:20, Mark Nottingham wrote: > > On 10/03/2010, at 12:19 AM, Julian Reschke wrote: > > [...] > >> Before I go on with the actual change for issue 29, I'd like to collect some feedback on the rearranged text, defining the data for the age calculation. > > I think so. > >> Also - Mark - is...: >> >> "See Section 9.3.1 of [Part1] for requirements regarding responses without a Date response header." >> >> this the reference you had in mind for absent Date headers? > ... Very good, that simplifies the text further. I also noted that request_time was explained twice, which gets us to (<http://trac.tools.ietf.org/wg/httpbis/trac/changeset/784>): -- snip -- 2.3.2. Calculating Age HTTP/1.1 uses the Age response-header to convey the estimated age of the response message when obtained from a cache. The Age field value is the cache's estimate of the amount of time since the response was generated or validated by the origin server. In essence, the Age value is the sum of the time that the response has been resident in each of the caches along the path from the origin server, plus the amount of time it has been in transit along network paths. The following data is used for the age calculation: age_value The term "age_value" denotes the value of the Age header (Section 3.1), in a form appropriate for arithmetic operation; or 0, if not available. date_value HTTP/1.1 requires origin servers to send a Date header, if possible, with every response, giving the time at which the response was generated. The term "date_value" denotes the value of the Date header, in a form appropriate for arithmetic operations. See Section 9.3 of [Part1] for the definition of the Date header, and for requirements regarding responses without a Date response header. now The term "now" means "the current value of the clock at the host performing the calculation". Hosts that use HTTP, but especially hosts running origin servers and caches, SHOULD use NTP ([RFC1305]) or some similar protocol to synchronize their clocks to a globally accurate time standard. request_time The current value of the clock at the host at the time the request resulting in the stored response was made. response_time The current value of the clock at the host at the time the response was received. A response's age can be calculated in two entirely independent ways: 1. now minus date_value, if the local clock is reasonably well synchronized to the origin server's clock. If the result is negative, the result is replaced by zero. 2. age_value, if all of the caches along the response path implement HTTP/1.1. These are combined as corrected_received_age = max(now - date_value, age_value) When an Age value is received, it MUST be interpreted relative to the time the request was initiated, not the time that the response was received. corrected_initial_age = corrected_received_age + (now - request_time) The current_age of a stored response can then be calculated by adding the amount of time (in seconds) since the stored response was last validated by the origin server to the corrected_initial_age. With these definitions, the current_age can be calculated as per: 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; -- snip -- Best regards, Julian
Received on Wednesday, 10 March 2010 08:51:26 UTC