If the name of the script ($SCRIPT_NAME or $SCRIPT_FILENAME CGI environment variable, or __FILE__ literal) ends with '.fcgi' extension, run gitweb in FastCGI mode, as if it was run with '--fastcgi' / '--fcgi' option. This is intended for easy deploying gitweb using FastCGI interface. Signed-off-by: Jakub Narebski <jnareb@xxxxxxxxx> --- This patch is based on a0446e7 commit (gitweb: Add support for FastCGI, using CGI::Fast, 2010-05-07), currently in 'next' (from 'jn/gitweb-fastcgi' branch). I have not actually tested that it runs as FastCGI script. Now to run gitweb using FastCGI, all one has to do is to rename it from gitweb.cgi to gitweb.fcgi. And of course configure web server to run it using FastCGI interface. gitweb/gitweb.perl | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index c42c16f..47ef993 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -1056,19 +1056,24 @@ our $is_last_request = sub { 1 }; our ($pre_dispatch_hook, $post_dispatch_hook, $pre_listen_hook); our $CGI = 'CGI'; our $cgi; +sub configure_as_fcgi { + require CGI::Fast; + our $CGI = 'CGI::Fast'; + + my $request_number = 0; + # let each child service 100 requests + our $is_last_request = sub { ++$request_number > 100 }; +} sub evaluate_argv { + my $script_name = $ENV{'SCRIPT_NAME'} || $ENV{'SCRIPT_FILENAME'} || __FILE__; + configure_as_fcgi() + if $script_name =~ /\.fcgi$/; + return unless (@ARGV); require Getopt::Long; Getopt::Long::GetOptions( - 'fastcgi|fcgi|f' => sub { - require CGI::Fast; - our $CGI = 'CGI::Fast'; - - my $request_number = 0; - # let each child service 100 requests - our $is_last_request = sub { ++$request_number > 100 }; - }, + 'fastcgi|fcgi|f' => \&configure_as_fcgi, 'nproc|n=i' => sub { my ($arg, $val) = @_; return unless eval { require FCGI::ProcManager; 1; }; -- 1.7.0.1 -- 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