Skip to content

Commit 5ed2ec1

Browse files
jnarebgitster
authored andcommitted
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>
1 parent a5080d8 commit 5ed2ec1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

gitweb/gitweb.perl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,8 +1000,16 @@ sub handle_errors_html {
10001000
die_error(400, "Project needed");
10011001
}
10021002
$actions{$action}->();
1003+
10031004
DONE_GITWEB:
1004-
1;
1005+
if (defined caller) {
1006+
# wrapped in a subroutine processing requests,
1007+
# e.g. mod_perl with ModPerl::Registry, or PSGI with Plack::App::WrapCGI
1008+
return;
1009+
} else {
1010+
# pure CGI script, serving single request
1011+
exit;
1012+
}
10051013

10061014
## ======================================================================
10071015
## action links

0 commit comments

Comments
 (0)