You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Roy T. Fielding" <fi...@liege.ICS.UCI.EDU> on 1996/06/08 02:06:37 UTC

Re: Apache and Proxy/Cache servers

thinking out loud ...

>>-/* Need to set Expires date less than value of Date header for cache servers */
>>-    if (r->no_cache)
>>-	table_set(r->headers_out, "Expires",
>>-		gm_timestr_822 (r->pool,time(NULL)));
>>+    

HTTP is designed such that a server should set the request time once
(somewhere in the passed-around request structure) just before
reading/starting any files/scripts, and then use that time for
the Date field, testing last-mod time is not greater-than date,
and setting Expires to the same value as Date if no_cache or
if it is a file and last-mod == Date.  All this should be done with
one call to time() and one call to gm_timestr_822(), since it is worth it
to save both values in memory.

Apache may already do that -- I'm just too lazy to check right now... ;-)

.....Roy

p.s. the reason to set Expires = Date when a file last-mod == Date is
     so that a file that changes as it is being read will not be cached
     (a smart cache will use the same heuristic, but not all caches are
     smart).