[core] server.error-handler new directive for error pages (fixes #2702)
[lighttpd.git] / tests / docroot / www / 404.pl
blob0c0668a3041e8f6bf4a1c36a9fb5549ff477db32
1 #!/usr/bin/env perl
3 use CGI qw/:standard/;
5 my $cgi = new CGI;
6 my $request_uri = $ENV{'REQUEST_URI'}; # server.error-handler-404
7 my $redirect_uri= $ENV{'REDIRECT_URI'}; # server.error-handler
8 print (STDERR "REQUEST_URI: $request_uri\n");
9 print (STDERR "REDIRECT_URI: $redirect_uri\n");
11 if ($request_uri =~ m/^\/dynamic\/200\// ) {
12 print header ( -status => 200,
13 -type => 'text/plain' );
14 print ("found here\n");
16 elsif ($request_uri =~ m|^/dynamic/302/| ) {
17 print header( -status=>302,
18 -location => 'http://www.example.org/');
20 elsif ($request_uri =~ m/^\/dynamic\/404\// ) {
21 print header ( -status => 404
22 -type => 'text/plain' );
23 print ("Not found here\n");
25 elsif ($request_uri =~ m/^\/send404\.pl/ ) {
26 print header ( -status => 404
27 -type => 'text/plain' );
28 print ("Not found here (send404)\n");
30 elsif ($request_uri =~ m/^\/dynamic\/nostatus\// ) {
31 print ("found here\n");
33 elsif ($redirect_uri =~ m/^\/dynamic\/redirect_status\// ) {
34 print header ( -status => $ENV{'REDIRECT_STATUS'},
35 -type => 'text/plain');
36 print ("REDIRECT_STATUS\n");
38 else {
39 print header ( -status => 500,
40 -type => 'text/plain');
41 print ("huh\n");