- From: Julian Reschke <julian.reschke@gmx.de>
- Date: Wed, 10 Mar 2010 16:41:10 +0100
- To: Mark Nottingham <mnot@mnot.net>
- CC: HTTP Working Group <ietf-http-wg@w3.org>
On 10.03.2010 09:50, Julian Reschke wrote:
> ...
In the meantime I realized that the current text is totally confusing
because it first uses "now" as "time the response is received", and then
later as "time the age is calculated". This is also reflected in pseudo
code statements that are repeated, and in which "now" is replaced by
"response_time".
I just fixed this by using "now", "request_time" and "response_time"
consistently, which also allowed getting rid of duplicated pseudo-code.
I think this improves readability a lot. See
<http://trac.tools.ietf.org/wg/httpbis/trac/changeset/786>.
New text:
-- 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. age_value, if all of the caches along the response path implement
HTTP/1.1.
These are combined as
apparent_age = max(0, response_time - date_value);
corrected_received_age = max(apparent_age, 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.
response_delay = response_time - request_time;
corrected_initial_age = corrected_received_age + response_delay;
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 --
Best regards, Julian
Received on Wednesday, 10 March 2010 15:41:49 UTC