NAME

Apache::HeavyCGI::IfModified - Within Apache::HeavyCGI return 304

SYNOPSIS

require Apache::HeavyCGI::IfModified;
push @{$mgr->{HANDLER}},
    "Apache::HeavyCGI::IfModified"; # $mgr is an Apache::HeavyCGI object

DESCRIPTION

If-modified-since is tricky. We have pages with very differing last modification. Some are modified NOW, some are old, most are MADE now but would have been just the same many hours ago.

Because it's the recipe that is used for the composition of a page, it may well be that a page that has never been generated before, nonetheless has a Last-Modified date in the past. The Last-Modified header acts as a weak validator for cache activities, and the older a document appears to be, the longer the cache will store it for us by default. When the cache revisits us after it has got a valid Last-Modified header, it will use an If-Modified-Since header and if we carefully determine our own Last-Modified time, we can spare a lot of processing by returning a Not Modified response instead of working.

IfModified should be one of the last handlers in any Apache::HeavyCGI environment, at least it must be processed after all the handlers that might set the LAST_MODIFIED date.