[tests] remove dependency on CGI.pm
CGI.pm is no longer shipped as part of Perl core distribution (and is easily replaced)personal/stbuehler/mod-csrf-old
parent
c489dd6cc4
commit
d147673d40
@ -1,42 +1,43 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use CGI qw/:standard/;
|
||||
|
||||
my $cgi = new CGI;
|
||||
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,
|
||||
-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 ($redirect_uri =~ m/^\/dynamic\/redirect_status\// ) {
|
||||
print header ( -status => $ENV{'REDIRECT_STATUS'},
|
||||
-type => 'text/plain');
|
||||
print ("REDIRECT_STATUS\n");
|
||||
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";
|
||||
};
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env perl
|
||||
use CGI qw/:standard/;
|
||||
print header ( -status => 404
|
||||
-type => 'text/plain' );
|
||||
print ("send404\n");
|
||||
|
||||
print "Status: 404\n",
|
||||
"Content-Type: text/plain\n",
|
||||
"\n",
|
||||
"send404\n";
|
||||
|
Loading…
Reference in New Issue