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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff Garzik wrote:
> Jakub Narebski wrote:
>> Jeff Garzik wrote:
>>> Jakub Narebski wrote:
>>>>
>>>> P.S. Any hints to how to do this with CGI Perl module?
>>>
>>> It's impossible, Apache doesn't supply e-tag info to CGI programs.  (it 
>>> does supply HTTP_CACHE_CONTROL though apparently)
>> 
>> By ETag info you mean access to HTTP headers sent by browser
>> If-Modified-Since:, If-Match:, If-None-Match: do you?

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.

But of course gitweb should rather use mod_perl if possible, so
somewhere in gitweb there would be the following line:

  $in_date = $ENV{'MOD_PERL'} ?
    $r->header('If-Modified-Since') :
    $ENV{'HTTP_IF_MODIFIED_SINCE'};

or something like that...
 
> You can use this attached shell script as a CGI script, to see precisely 
> what information Apache gives you.  You can even experiment with passing 
> back headers other than Content-type (such as E-tag), to see what sort 
> of results are produced.  The script currently passes back both E-Tag 
> and Last-Modified of a sample file; modify or delete those lines to suit 
> your experiments.

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 a pity that CGI interface doesn't cover that...
>> 
>>> You could probably do it via mod_perl.
>> 
>> So the cache verification should be wrapped in if ($ENV{MOD_PERL}) ?
> 
> Sorry, I was /assuming/ mod_perl would make this available.  The HTTP 
> header info is available to all Apache modules, but I confess I have no 
> idea how mod_perl passes that info to scripts.
> 
> Also, an interesting thing while I was testing the attached shell 
> script:  even though repeated hits to the script generate a proper 304 
> response to the browse, the CGI script and its output run to completion. 
>   So, it didn't save work on the CGI side; the savings was solely in not 
> transmitting the document from server to client.  The server still went 
> through the work of generating the document (by running the CGI), as one 
> would expect.

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

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.

-- 
Jakub Narebski
Poland
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]