$actions{$action}->();
}
-sub run_request {
+sub reset_timer {
our $t0 = [Time::HiRes::gettimeofday()]
if defined $t0;
+ our $number_of_git_cmds = 0;
+}
+
+sub run_request {
+ reset_timer();
evaluate_uri();
- evaluate_gitweb_config();
- evaluate_git_version();
check_loadavg();
- # $projectroot and $projects_list might be set in gitweb config file
- $projects_list ||= $projectroot;
-
evaluate_query_params();
evaluate_path_info();
evaluate_and_validate_params();
sub run {
evaluate_argv();
+ evaluate_gitweb_config();
+ evaluate_git_version();
+
+ # $projectroot and $projects_list might be set in gitweb config file
+ $projects_list ||= $projectroot;
$pre_listen_hook->()
if $pre_listen_hook;
run();
+if (defined caller) {
+ # wrapped in a subroutine processing requests,
+ # e.g. mod_perl with ModPerl::Registry, or PSGI with Plack::App::WrapCGI
+ return;
+} else {
+ # pure CGI script, serving single request
+ exit;
+}
+
## ======================================================================
## action links
sub esc_url {
my $str = shift;
return undef unless defined $str;
- $str =~ s/([^A-Za-z0-9\-_.~();\/;?:@&=])/sprintf("%%%02X", ord($1))/eg;
- $str =~ s/\+/%2B/g;
+ $str =~ s/([^A-Za-z0-9\-_.~();\/;?:@&= ]+)/CGI::escape($1)/eg;
$str =~ s/ /\+/g;
return $str;
}