--- embedaddon/lighttpd/tests/docroot/www/404.pl 2013/10/14 10:32:47 1.1 +++ embedaddon/lighttpd/tests/docroot/www/404.pl 2016/11/02 10:35:00 1.1.1.2 @@ -1,33 +1,42 @@ -#!/usr/bin/perl -use CGI qw/:standard/; -my $cgi = new CGI; +#!/usr/bin/env perl + my $request_uri = $ENV{'REQUEST_URI'}; -print (STDERR "REQUEST_URI: $request_uri\n"); if ($request_uri =~ m/^\/dynamic\/200\// ) { - print header ( -status => 200, - -type => 'text/plain' ); - print ("found here\n"); + print "Status: 200\n", + "Content-Type: text/plain\n", + "\n", + "found here\n"; } elsif ($request_uri =~ m|^/dynamic/302/| ) { - print header( -status=>302, - -location => 'http://www.example.org/'); + print "Status: 302\n", + "Location: http://www.example.org/\n", + "\n"; } elsif ($request_uri =~ m/^\/dynamic\/404\// ) { - print header ( -status => 404 - -type => 'text/plain' ); - print ("Not found here\n"); + print "Status: 404\n", + "Content-Type: text/plain\n", + "\n", + "Not found here\n"; } elsif ($request_uri =~ m/^\/send404\.pl/ ) { - print header ( -status => 404 - -type => 'text/plain' ); - print ("Not found here (send404)\n"); + print "Status: 404\n", + "Content-Type: text/plain\n", + "\n", + "Not found here (send404)\n"; } elsif ($request_uri =~ m/^\/dynamic\/nostatus\// ) { print ("found here\n"); } +elsif ($request_uri =~ m/^\/dynamic\/redirect_status\// ) { + print "Status: $ENV{'REDIRECT_STATUS'}\n", + "Content-Type: text/plain\n", + "\n", + "REDIRECT_STATUS\n"; +} else { - print header ( -status => 500, - -type => 'text/plain'); - print ("huh\n"); + print "Status: 500\n", + "Content-Type: text/plain\n", + "\n", + "huh\n"; };