gitwebcache.sh: set REQUEST_METHOD before running gitweb.cgi
commit21d87320d8bb209c96a6abb4627316bf0b6de3c1
authorKyle J. McKay <mackyle@gmail.com>
Tue, 19 Nov 2013 01:59:21 +0000 (18 17:59 -0800)
committerKyle J. McKay <mackyle@gmail.com>
Tue, 19 Nov 2013 01:59:21 +0000 (18 17:59 -0800)
tree8009017d589531d7d3ea3d5a6505a6fb2378d7e1
parent1991cb46128f2a0c5e5207bb07c5bb2d4feead95
gitwebcache.sh: set REQUEST_METHOD before running gitweb.cgi

When the following change was made to the gitweb.cgi source:

  1daeb5ba gitweb.perl: only allow GET and HEAD methods

the gitweb.cgi script started exiting early with a 405 error unless
it was passed either a GET or HEAD request method.  This change is
good in that it minimizes the time spent by gitweb.cgi processing
bogus requests generated by bots/DOS/hackers etc.

The gitwebcache.sh script essentially runs the gitweb.cgi script
in order to load its function definitions and use them to regenerate
the cache file.  Unfortunately this looks just like a normal web
request to gitweb.cgi and it bails early now if REQUEST_METHOD is not
set to either GET or HEAD.

Set REQUEST_METHOD to HEAD when running gitweb.cgi so that the
necessary cache rebuilding functions can be accessed.

The value GET could also be used, but looking forward to a time when
gitweb.cgi optimizes the handling of HEAD (which could potentially
need to use a lot less CPU time than GET), HEAD is preferred since
gitwebcache.sh discards the actual output of gitweb.cgi.
jobs/gitwebcache.sh