1#!/usr/bin/env perl 2 3my $request_uri = $ENV{'REQUEST_URI'}; 4 5if ($request_uri =~ m/^\/dynamic\/200\// ) { 6 print "Status: 200\n", 7 "Content-Type: text/plain\n", 8 "\n", 9 "found here\n"; 10} 11elsif ($request_uri =~ m|^/dynamic/302/| ) { 12 print "Status: 302\n", 13 "Location: http://www.example.org/\n", 14 "\n"; 15} 16elsif ($request_uri =~ m/^\/dynamic\/404\// ) { 17 print "Status: 404\n", 18 "Content-Type: text/plain\n", 19 "\n", 20 "Not found here\n"; 21} 22elsif ($request_uri =~ m/^\/send404\.pl/ ) { 23 print "Status: 404\n", 24 "Content-Type: text/plain\n", 25 "\n", 26 "Not found here (send404)\n"; 27} 28elsif ($request_uri =~ m/^\/dynamic\/nostatus\// ) { 29 print ("found here\n"); 30} 31elsif ($request_uri =~ m/^\/dynamic\/redirect_status\// ) { 32 print "Status: $ENV{'REDIRECT_STATUS'}\n", 33 "Content-Type: text/plain\n", 34 "\n", 35 "REDIRECT_STATUS\n"; 36} 37elsif ($ENV{PATH_INFO} eq "/internal-redir" ) { 38 # (not actually 404 error, but use separate script from cgi.pl for testing) 39 print "Status: 200\r\n\r\n"; 40} 41else { 42 print "Status: 500\n", 43 "Content-Type: text/plain\n", 44 "\n", 45 "huh\n"; 46}; 47