Subject: Re: kernel.org mirroring (Re: [GIT PULL] MMC update)

From: Jeff Garzik <[email-masked]>
Date: Sun, 10 Dec 2006 17:05:32 -0500

Jakub Narebski wrote:
> Adn in CGI standard there is a way to access additional HTTP headers
> info from CGI script: the envirionmental variables are HTTP_HEADER,
> for example if browser sent If-Modified-Since: header it's value
> can be found in HTTP_IF_MODIFIED_SINCE environmental variable.

The CGI spec does not at all guarantee that the CGI environment will 
contain all the HTTP headers sent by the client.  That was the point of 
the environment dump script -- you can see exactly which headers are, 
and are not, passed through to CGI.

CGI only /guarantees/ a bare minimum (things like QUERY_STRING, 
PATH_INFO, etc.)

Even basic server info environment variables are optional.

> It is ETag, not E-tag. Besides, I don't see what the attached script is
> meant to do: it does not output the sample file anyway.

It's not meant to output the sample file.  It outputs the server 
metadata sent to the CGI script (the environment variables).  The sample 
file was simply a way to play around with etag and last-modified metadata.

> The idea is of course to stop processing in CGI script / mod_perl script
> as soon as possible if cache validates.

Certainly.  That should help cut down on I/O.  FWIW though the projects 
list is particularly painful, with its File::Find call, which you'll 
need to do in order to return 304-not-modified.

> I don't know if Apache intercepts and remembers ETag and Last-Modified
> headers, adds 304 Not Modified HTTP response on finding that cache validates
> and cuts out CGI script output. I.e. if browser provided If-Modified-Since:,
> script wrote Last-Modified: header, If-Modified-Since: is no earlier than
> Last-Modified: (usually is equal in the case of cache validation), then
> Apache provides 304 Not Modified response instead of CGI script output.

This wanders into the realm of mod_cache configuration, I think.  (which 
I have tried to get working as reverse proxy, and failed serveral times) 
  If you are not using mod_*_cache, then Apache must execute the CGI 
script every time AFAICS, regardless of etag/[if-]last-mod headers.

	Jeff