summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJan Kneschke <jan@kneschke.de>2007-08-18 11:35:27 +0000
committerJan Kneschke <jan@kneschke.de>2007-08-18 11:35:27 +0000
commit41e836b4105cee225f4759e63a8e037e964bc695 (patch)
treecf821ec80df752cbf640215a817fbaab55d9ebf6 /tests
parentf67cdb67df59e921c19493b8616b7d8e80807d47 (diff)
downloadlighttpd-git-41e836b4105cee225f4759e63a8e037e964bc695.tar.gz
fixed extracting status code from NPH scripts (fixes #1125)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1948 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'tests')
-rwxr-xr-xtests/docroot/www/nph-status.pl8
-rwxr-xr-xtests/mod-cgi.t20
2 files changed, 24 insertions, 4 deletions
diff --git a/tests/docroot/www/nph-status.pl b/tests/docroot/www/nph-status.pl
index 528791be..d817c7fd 100755
--- a/tests/docroot/www/nph-status.pl
+++ b/tests/docroot/www/nph-status.pl
@@ -1,4 +1,10 @@
#!/usr/bin/perl
-print "HTTP/1.0 30 FooBar\r\n";
+my $status = 200;
+
+if (defined $ENV{"QUERY_STRING"}) {
+ $status = $ENV{"QUERY_STRING"};
+}
+
+print "HTTP/1.0 ".$status." FooBar\r\n";
print "\r\n";
diff --git a/tests/mod-cgi.t b/tests/mod-cgi.t
index f3952879..b89a1af6 100755
--- a/tests/mod-cgi.t
+++ b/tests/mod-cgi.t
@@ -8,7 +8,7 @@ BEGIN {
use strict;
use IO::Socket;
-use Test::More tests => 16;
+use Test::More tests => 18;
use LightyTest;
my $tf = LightyTest->new();
@@ -40,11 +40,25 @@ $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-
ok($tf->handle_http($t) == 0, 'perl via cgi + pathinfo');
$t->{REQUEST} = ( <<EOF
-GET /nph-status.pl HTTP/1.0
+GET /nph-status.pl?30 HTTP/1.0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
-ok($tf->handle_http($t) == 0, 'NPH + perl, Bug #14');
+ok($tf->handle_http($t) == 0, 'NPH + perl, invalid status-code (#14)');
+
+$t->{REQUEST} = ( <<EOF
+GET /nph-status.pl?304 HTTP/1.0
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ];
+ok($tf->handle_http($t) == 0, 'NPH + perl, setting status-code (#1125)');
+
+$t->{REQUEST} = ( <<EOF
+GET /nph-status.pl?200 HTTP/1.0
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
+ok($tf->handle_http($t) == 0, 'NPH + perl, setting status-code');
$t->{REQUEST} = ( <<EOF
GET /get-header.pl?GATEWAY_INTERFACE HTTP/1.0