summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Narebski <jnareb@gmail.com>2010-06-13 10:09:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-06-14 17:55:38 (GMT)
commit5ed2ec1041b6aeec81b0f0a9775355a9b2c755a6 (patch)
tree6985959fcf25563c3dec78b636d868ed3cac3e5f
parenta5080d8e10915daa57b5b42c887483d202b45c55 (diff)
downloadgit-5ed2ec1041b6aeec81b0f0a9775355a9b2c755a6.zip
git-5ed2ec1041b6aeec81b0f0a9775355a9b2c755a6.tar.gz
git-5ed2ec1041b6aeec81b0f0a9775355a9b2c755a6.tar.bz2
gitweb: Return or exit after done serving request
Check if there is a caller in top frame of gitweb, and either 'return' if gitweb code is wrapped in subroutine, or 'exit' if it is not. This should avoid gitweb.cgi: Subroutine git_SOMETHING redefined at gitweb.cgi line NNN warnings in error_log when running gitweb with mod_perl (using ModPerl::Registry handler) Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xgitweb/gitweb.perl10
1 files changed, 9 insertions, 1 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 2365311..9d2b8c3 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1000,8 +1000,16 @@ if ($action !~ m/^(?:opml|project_list|project_index)$/ &&
die_error(400, "Project needed");
}
$actions{$action}->();
+
DONE_GITWEB:
-1;
+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