W3C home > Mailing lists > Public > ietf-http-wg@w3.org > January to March 2010

Re: #29: correcting corrected_initial_age

From: Julian Reschke <julian.reschke@gmx.de>
Date: Wed, 10 Mar 2010 09:50:38 +0100
Message-ID: <4B975D5E.10505@gmx.de>
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 

-- 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:


       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.


       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.


       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.


       The current value of the clock at the host at the time the request
       resulting in the stored response was made.


       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

    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

      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

This archive was generated by hypermail 2.4.0 : Thursday, 2 February 2023 18:43:21 UTC