gitweb/lib - HTTP-aware output cachinggitweb/cache-kernel-short-pu
commit4b1380d624bd97e8bc86f163da3c1ee7de8c5f39
authorJakub Narebski <jnareb@gmail.com>
Wed, 5 Jan 2011 12:49:31 +0000 (5 13:49 +0100)
committerJakub Narebski <jnareb@gmail.com>
Wed, 5 Jan 2011 12:49:31 +0000 (5 13:49 +0100)
tree13d050266e05f7c66000240814199fcf3b559d43
parentada9983c4256f5a7bac1f7f0e29d52011741d6aa
gitweb/lib - HTTP-aware output caching

This commit adds new option, -http_output, to cache_output()
subroutine from GitwebCache::CacheOutput module.  When this subroutine
is called as cache_output(..., -http_output => 1), it assumes that
cached output is HTTP response, consisting of HTTP headers separated
by CR LF pair from the HTTP body (contents of the page).  It adds then
Expires and Cache-Control: max-age headers if they do not exist based
on current cache entry expiration time, and Content-Length header
based on the size of cache entry file.

New subtest in t9512 includes basic tests for this feature.

Enable it in gitweb, via $cache_options{'cache_output'} hashref.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
gitweb/gitweb.perl
gitweb/lib/GitwebCache/CacheOutput.pm
gitweb/lib/GitwebCache/FileCacheWithLocking.pm
t/t9512/test_cache_output.pl