- From: Julian Reschke <julian.reschke@gmx.de>
- Date: Thu, 11 Mar 2010 20:29:07 +0100
- To: Mark Nottingham <mnot@mnot.net>
- CC: HTTP Working Group <ietf-http-wg@w3.org>
On 11.03.2010 01:16, Mark Nottingham wrote:
> Looks good. The algorithm changes still needs to be applied, however.
> ...
Here we go:
-- 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. the "apparent_age": response_time 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. the "corrected_age_value", if all of the caches along the
response path implement HTTP/1.1; note this value MUST be
interpreted relative to the time the request was initiated, not
the time that the response was received.
apparent_age = max(0, response_time - date_value);
response_delay = response_time - request_time;
corrected_age_value = age_value + response_delay;
These are combined as
corrected_initial_age = max(apparent_age, corrected_age_value);
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.
resident_time = now - response_time;
current_age = corrected_initial_age + resident_time;
-- snip --
(see
<http://trac.tools.ietf.org/wg/httpbis/trac/attachment/ticket/29/i29.diff>)
Best regards, Julian
Received on Thursday, 11 March 2010 19:30:13 UTC