Sunday, 15 April 2012

http - What is the expected cache behaviour when both Date and Expires values are in the past? -



http - What is the expected cache behaviour when both Date and Expires values are in the past? -

a standard method specifying cache behaviour in response headers set both date value , expires value. (along kind of cache-control directive such cache-control=public).

assuming request made @ time now, let's say, now is:

tue, 24 jun 2014 13:36:05 gmt

then standard response sets cache value of 1 hr might include next headers:

date: tue, 24 jun 2014 13:36:05 gmt expires: tue, 24 jun 2014 14:36:05 gmt

this (and should) tell intermediary caches or pops cache resource 1 hr now.

however, if both expires value and date value in past. (perhaps, say, because of particularly erroneous server clock won't changed in useful timeframe).

if consider request beingness made @ same time, now being:

tue, 24 jun 2014 13:36:05 gmt

what if corresponding response contained next header values:

date: tue, 24 jun 2014 11:10:00 gmt expires: tue, 24 jun 2014 11:44:00 gmt

here, both values past. expires value in past plenty trigger no-cache, effect of date value beingness in past.

should cache implementations utilize value of date calculate offset expires, , utilize create expiry value of now + offset?

rfc2616 date section http://www.w3.org/protocols/rfc2616/rfc2616-sec14.html#sec14.18 not mention date value in past

rfc2616 expires section http://www.w3.org/protocols/rfc2616/rfc2616-sec14.html#sec14.21 stipulates if date === expires, reponse 'already expired'.

neither of these seem mention case both date , expires have past?

update / rfc2616 dead farther reading suggests rfc2616 dead , has been superseded set of more specific rfcs.

the new rfc7234 - http/1.1: caching contains calculating freshness lifetime contains next statement:

if expires response header field present, utilize value minus value of date response header field

this seems specify outlined above - utilize expires value of:

expiry=(expires - date) + now

there not seem equivalent statement in original rfc. still next rfc2616, behaviour individual browser/cache vendors?

in 2616, corresponding section 13.2.3 age calculations.

http caching http-headers cache-control rfc2616

No comments:

Post a Comment