RE: Cacheing and mhonarc indexes

1998-02-24 08:55:58
Nevel, Simeon writes:
Can you describe *exactly* what the "Last-Modified" header should 
look and where it should be added?  

It's in the HTTP spec, but digging it out of there can be a chore, so
here is how I use it.  Simply include the "Last-Modified: $date" header
line anywhere in the list of header lines that are output before the
double blank line.  The $date is in www format, which looks like: "Thu,
16 Dec 1993 07:59:59 GMT".

Also, I forgot to mention that you should include the header line:
"Cache-Control: must-revalidate".  That is what causes caches to ask the
server for updates every time by using the If-Modified-Since header,
although they might send that header anyway if they have a cached
version of a document that looks rather old.

When you get a request that includes an "If-Modified-Since:
$lastknowndate" header, then compare the $lastknowndate it gives you
with the real last mod date that you know (say by looking at the mtime
of the index file).  Send the new version normally if it is newer.
Otherwise output a "Status: 304" line which means "Not Modified"; this
causes the server to convert that line into a 304 status.

Daniel LaLiberte
 dlaliberte(_at_)gte(_dot_)com  (was: liberte(_at_)ncsa(_dot_)uiuc(_dot_)edu)

<Prev in Thread] Current Thread [Next in Thread>