Re: [PATCH 14/18] gitweb: add print_transient_header() function for central header printing
- From
J.H. <warthog9@eaglescrag.net>
- Date
- Dec 10, 2010, 06:18 UTC
- Message-ID
- <4D01C630.30400@eaglescrag.net>
- In-Reply-To
- <m34oam1n3t.fsf@localhost.localdomain>
Show 6 quoted lines
>> +sub print_transient_header {
>> + print $::cgi->header(
>
> Why you use $::cgi->header() instead of equivalent $cgi->header()?
> Note that $::cgi->header() is $main::cgi->header(), and is not
> CGI::header().Because $main::cgi already was setup. Since I'm not redefining $cgi anywhere they evaluate to the same thing since cgi is already a global variable coming from gitweb itself.
The way I have it now is it's more explicit to being the parent (main). It doesn't really matter either way, but I can change it if you like.
Show 37 quoted lines
>> + -type=>'text/html',
>> + -charset => 'utf-8',
>> + -status=> 200,
>> + -expires => 'now',
>> + # HTTP/1.0
>> + -Pragma => 'no-cache',
>> + # HTTP/1.1
>> + -Cache_Control => join(
>> + ', ',
>> + qw(
>> + private
>> + no-cache
>> + no-store
>> + must-revalidate
>> + max-age=0
>> + pre-check=0
>> + post-check=0
>> + )
>> + )
>> + );
>> + return;
>> +}
>
> Why not use
>
> our %no_cache = (
> # HTTP/1.0
> -Pragma => 'no-cache',
> # HTTP/1.1
> -Cache_Control => join(', ', qw(private no-cache no-store must-revalidate
> max-age=0 pre-check=0 post-check=0)),
> );
>
> (or something like that). This way you can reuse it even if content
> type is different (e.g. 'text/plain').
>
> But that is just a proposal.Finer grained control, though they have the same basic setup. Probably will add that, though it's not that big of a deal.
- John 'Warthog9' Hawley