summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarcus Rückert <darix@opensu.se>2007-08-13 14:34:50 +0000
committerMarcus Rückert <darix@opensu.se>2007-08-13 14:34:50 +0000
commit2573648c4b4bd23dd23819dee62eb9849dea73e3 (patch)
tree7d1f77307196c4c469e796f720319329c1f037f7 /tests
parentdac6d449dd48d74ec5371ca6c78a5f040c7958d8 (diff)
downloadlighttpd-git-2573648c4b4bd23dd23819dee62eb9849dea73e3.tar.gz
- added testcase for #948
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1901 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'tests')
-rw-r--r--tests/404-handler.conf2
-rw-r--r--tests/core-404-handler.t17
-rwxr-xr-xtests/docroot/www/404.pl11
-rwxr-xr-xtests/docroot/www/send404.pl5
4 files changed, 32 insertions, 3 deletions
diff --git a/tests/404-handler.conf b/tests/404-handler.conf
index 713a8a5e..65f2e5ee 100644
--- a/tests/404-handler.conf
+++ b/tests/404-handler.conf
@@ -44,6 +44,6 @@ cgi.assign = (".pl" => "/usr/bin/perl" )
$HTTP["url"] =~ "^/static/" {
server.error-handler-404 = "/404.html"
}
-else $HTTP["url"] =~ "^/dynamic/" {
+else $HTTP["url"] =~ "." {
server.error-handler-404 = "/404.pl"
}
diff --git a/tests/core-404-handler.t b/tests/core-404-handler.t
index 91b11e2b..8056c691 100644
--- a/tests/core-404-handler.t
+++ b/tests/core-404-handler.t
@@ -7,6 +7,7 @@
# returning 200
# returning 302 + Location
# returning 404
+# returning no status -> 200
#
BEGIN {
# add current source dir to the include-path
@@ -17,7 +18,7 @@ BEGIN {
use strict;
use IO::Socket;
-use Test::More tests => 6;
+use Test::More tests => 8;
use LightyTest;
my $tf = LightyTest->new();
@@ -57,5 +58,19 @@ EOF
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'HTTP-Content' => "Not found here\n" } ];
ok($tf->handle_http($t) == 0, '404 handler => dynamic(404)');
+$t->{REQUEST} = ( <<EOF
+GET /dynamic/nostatus/notfound HTTP/1.0
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => "found here\n" } ];
+ok($tf->handle_http($t) == 0, '404 handler => dynamic(nostatus)');
+
+$t->{REQUEST} = ( <<EOF
+GET /send404.pl HTTP/1.0
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ];
+ok($tf->handle_http($t) == 0, '404 generated by CGI should stay 404');
+
ok($tf->stop_proc == 0, "Stopping lighttpd");
diff --git a/tests/docroot/www/404.pl b/tests/docroot/www/404.pl
index 7c6d29bc..0f743d03 100755
--- a/tests/docroot/www/404.pl
+++ b/tests/docroot/www/404.pl
@@ -3,6 +3,7 @@ use CGI qw/:standard/;
my $cgi = new CGI;
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' );
@@ -17,8 +18,16 @@ elsif ($request_uri =~ m/^\/dynamic\/404\// ) {
-type => 'text/plain' );
print ("Not found here\n");
}
+elsif ($request_uri =~ m/^\/send404\.pl/ ) {
+ print header ( -status => 404
+ -type => 'text/plain' );
+ print ("Not found here (send404)\n");
+}
+elsif ($request_uri =~ m/^\/dynamic\/nostatus\// ) {
+ print ("found here\n");
+}
else {
- print header ( -status => 404,
+ print header ( -status => 500,
-type => 'text/plain');
print ("huh\n");
};
diff --git a/tests/docroot/www/send404.pl b/tests/docroot/www/send404.pl
new file mode 100755
index 00000000..a92dfa6c
--- /dev/null
+++ b/tests/docroot/www/send404.pl
@@ -0,0 +1,5 @@
+#!/usr/bin/perl
+use CGI qw/:standard/;
+print header ( -status => 404
+ -type => 'text/plain' );
+print ("send404\n");