Subject: A question about RFC7232#2.2.2

From: Michael Lee <[email-masked]>
Date: Sun, 4 Dec 2016 07:42:43 +0800

I am currently working on a tutorial of HTTP/1.1 caching, but I got 
stuck with the following statement in RFC7232 section 2.2.2:

" This method relies on the fact that if two different responses were 
sent by the origin server during the same second, but both had the same 
Last-Modified time, then at least one of those responses would have a 
Date <http://httpwg.org/specs/rfc7231.html#header.date> value equal to 
its Last-Modified time. The arbitrary 60-second limit guards against the 
possibility that the Date and Last-Modified values are generated from 
different clocks or at somewhat different times during the preparation 
of the response. An implementation /MAY/ use a value larger than 60 
seconds, if it is believed that 60 seconds is too short."

I don't understand why under the circumstance above, at least one of 
those responses would have a Date value equal to its Last-Modified time.

And what's the point of ensuring a 60 seconds gap between the 
Last-Modified time and Date?

-- 
Michael Lee / Managing Director / ZerusTech Ltd

Tel: +86 (21) 6107 3305

Mobile: +86 186 021 03818

Skype: zerustech

Email: [email-masked]

www.zerustech.com

Suite 9208
Building No. 9, 4361 HuTai Road
Shanghai
P.R.China
201906

---

From: Benedikt Christoph Wolters <[email-masked]>
Date: Sun, 4 Dec 2016 01:56:05 +0100

2016-12-04 0:42 GMT+01:00 Michael Lee <[email-masked]>:
> I don't understand why under the circumstance above, at least one of those responses would have a Date value equal to its Last-Modified time.
Strictly speaking I assume the sentence might be slightly wrong.
What might have been meant here is a scenario where two responses were
send in the same second with identical Last-Modified values and at at
least one Date value that is identical to the Last-Modified values.

> And what's the point of ensuring a 60 seconds gap between the Last-Modified
> time and Date?

If the Date and Last-Modified headers are within 60 seconds, it is
considered a weak validator, due to potential timing inconsistencies
between the Last-Modified clock and Date clock.

---

From: Michael Lee <[email-masked]>
Date: Tue, 6 Dec 2016 02:15:22 +0800

Hi Benedikt,

Thanks for your feedback.

After thinking it carefully, I think I have figured out the meaning of 
the following statement in RFC7232 section 2.2.2:

The following is my explanation to the statement above:

If the client holds a response and the response’s Last-Modified time is 
not a strong validator, then it means:

1) after the client received the response,  the representation has been 
modified by the origin server again (within the same second of the 
last-modified time); and

2) it does not matter whether the 2nd modification generated a response; and

3) the events must have happened in this way: the origin server modified 
the representation for the 1st time; the origin server sent the response 
to the client; the origin server modified the representation for the 2nd 
time; otherwise

4) if the events happened like this: the origin server modified the 
representation for the 1st time; the origin server modified the 
representation for the 2nd time; the origin server sent the response to 
the client; then

5) the 1st modification was not sent to any client, therefore, it 
actually never existed and the 2nd modification became the 1st 
modification; so

6) the response must have been sent to the client within the interval 
between the 1st and the 2nd modification, which is no greater than 1 
second; so

7) the Date value equals to the 1st and the 2nd modification time, due 
to the 1 second resolution.

To summarise, if the client holds a response whose Last-Modified time is 
not a strong validator, then the response’s Date value must equal to the 
response’s Last-Modified time.

Conversely, if the response’s Date value does not equal to  (is greater 
than, in fact) the response’s Last-Modified time, then the response’s 
Last-Modified time becomes a strong validator.

So if the client holds a response whose Date value is greater than its 
Last-Modified time, then the response’s Last-Modified time is a strong 
validator.

In practice, due to the time difference issue, the Last-Modified time 
might appear to be less than the Date value, but eventually be resolved 
to Date value. In order to avoid such circumstance, the Last-Modified 
time is constrained to be at least 60 seconds before the Date value, so 
that the resolved Last-Modified time is always before the Date value, 
even taking the time difference into account.

To summarise again, if the client holds a response whose Last-Modified 
is at least 60 seconds before its Date value, then the Last-Modified 
time is a strong validator. The arbitrary 60 seconds can be replaced by 
a larger value, if necessary, of course.

I hope this will be useful to others who also feel confused about this 
statement.

Kind regards,

Michael

Tel: +86 (21) 6107 3305

Skype: zerustech

www.zerustech.com

Suite 9208