summaryrefslogtreecommitdiff
path: root/tests/docroot
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2016-03-01 00:57:48 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2016-04-25 01:01:08 -0400
commitdbdab5dbc9b98df9c40f11e0fc6a6ce49bfea804 (patch)
tree453cf4eaadf12238d6aeef1c8fe48ceffbe47319 /tests/docroot
parent87b172e70e7a501f61061a2a4b82434b2db24bc7 (diff)
downloadlighttpd-git-dbdab5dbc9b98df9c40f11e0fc6a6ce49bfea804.tar.gz
[core] server.error-handler new directive for error pages (fixes #2702)
server.error-handler preserves HTTP status error code when error page is static, and allows dynamic handlers to change HTTP status code when error page is provided by dynamic handler. server.error-handler intercepts all HTTP status codes >= 400 except when the content is generated by a dynamic handler (cgi, ssi, fastcgi, scgi, proxy, lua). The request method is unconditionally changed to GET for the request to service the error handler, and the original request method is later restored (for logging purposes). request body from the original request, if present, is discarded. server.error-handler is somewhat similar to server.error-handler-404, but server.error-handler-404 is now deprecated, intercepts only 404 and 403 HTTP status codes, and returns 200 OK for static error pages, a source of confusion for some admins. On the other hand, the new server.error-handler, when set, will intercept all HTTP status error codes >= 400. server.error-handler takes precedence over server.error-handler-404 when both are set. NOTE: a major difference between server.error-handler and the now-deprecated server.error-handler-404 is that the values of the non-standard CGI environment variables REQUEST_URI and REDIRECT_URI have been swapped. Since REDIRECT_STATUS is the original HTTP status code, REDIRECT_URI is now the original request, and REQUEST_URI is the current request (e.g. the URI/URL to the error handler). The prior behavior -- which reversed REQUEST_URI and REDIRECT_URI values from those described above -- is preserved for server.error-handler-404. Additionally, REDIRECT_STATUS is now available to mod_magnet, which continues to have access to request.uri and request.orig_uri. See further discussion at https://redmine.lighttpd.net/issues/2702 and https://redmine.lighttpd.net/issues/1828 github: closes #36
Diffstat (limited to 'tests/docroot')
-rwxr-xr-xtests/docroot/www/404.pl11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/docroot/www/404.pl b/tests/docroot/www/404.pl
index 9486ed66..0c0668a3 100755
--- a/tests/docroot/www/404.pl
+++ b/tests/docroot/www/404.pl
@@ -3,8 +3,10 @@
use CGI qw/:standard/;
my $cgi = new CGI;
-my $request_uri = $ENV{'REQUEST_URI'};
-print (STDERR "REQUEST_URI: $request_uri\n");
+my $request_uri = $ENV{'REQUEST_URI'}; # server.error-handler-404
+my $redirect_uri= $ENV{'REDIRECT_URI'}; # server.error-handler
+print (STDERR "REQUEST_URI: $request_uri\n");
+print (STDERR "REDIRECT_URI: $redirect_uri\n");
if ($request_uri =~ m/^\/dynamic\/200\// ) {
print header ( -status => 200,
@@ -28,6 +30,11 @@ elsif ($request_uri =~ m/^\/send404\.pl/ ) {
elsif ($request_uri =~ m/^\/dynamic\/nostatus\// ) {
print ("found here\n");
}
+elsif ($redirect_uri =~ m/^\/dynamic\/redirect_status\// ) {
+ print header ( -status => $ENV{'REDIRECT_STATUS'},
+ -type => 'text/plain');
+ print ("REDIRECT_STATUS\n");
+}
else {
print header ( -status => 500,
-type => 'text/plain');