From: Mischa POSLAWSKY Date: Fri, 27 Jul 2007 19:13:52 +0000 (+0000) Subject: 404 handling for pre-parsed CGI handling X-Git-Tag: 3.20~28 X-Git-Url: http://git.shiar.net/perl/plp/.git/commitdiff_plain/072e8bc0a42031722a1c5005ebc6aa304e43c0a8 404 handling for pre-parsed CGI handling When using SCRIPT_FILENAME provided by server, still make sure the file exists. Lighttpd can provide non-existant files when setting check-local is turned off. PATH_TRANSLATED handling (i.e. Apache) is unaffected: always does 404 checking when walking the path. --- diff --git a/PLP/CGI.pm b/PLP/CGI.pm index ee81b37..9b72355 100644 --- a/PLP/CGI.pm +++ b/PLP/CGI.pm @@ -32,6 +32,11 @@ sub init { $ENV{SCRIPT_FILENAME} = $path; $ENV{SCRIPT_NAME} = $rel; } + elsif (not -f $ENV{SCRIPT_FILENAME}) { + print STDERR "PLP: Not found: $ENV{SCRIPT_FILENAME} ($ENV{REQUEST_URI})\n"; + PLP::error(undef, 404); + return; + } $ENV{"PLP_$_"} = $ENV{"SCRIPT_$_"} for qw/NAME FILENAME/;