summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kneschke <jan@kneschke.de>2005-08-21 23:12:56 +0000
committerJan Kneschke <jan@kneschke.de>2005-08-21 23:12:56 +0000
commitb22c094836b4f04bf46b152b770f1fdb9dbf0132 (patch)
tree996330a7d9de9851f1d13b0d27a437de19182fb8
parent35d3c10d81acca2eb485e3cfe716aa33c73510ca (diff)
downloadlighttpd-git-b22c094836b4f04bf46b152b770f1fdb9dbf0132.tar.gz
added testcase for header before we-got-content bug
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@604 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r--tests/docroot/www/get-header.pl8
-rw-r--r--tests/docroot/www/prefix.fcgi3
-rwxr-xr-xtests/mod-cgi.t26
3 files changed, 36 insertions, 1 deletions
diff --git a/tests/docroot/www/get-header.pl b/tests/docroot/www/get-header.pl
new file mode 100644
index 00000000..905f3e79
--- /dev/null
+++ b/tests/docroot/www/get-header.pl
@@ -0,0 +1,8 @@
+#!/usr/bin/perl
+
+my $s = $ENV{$ENV{"QUERY_STRING"}};
+
+printf("Content-Length: %d\r\n", length($s));
+print "Content-Type: text/plain\r\n\r\n";
+
+print $s;
diff --git a/tests/docroot/www/prefix.fcgi b/tests/docroot/www/prefix.fcgi
new file mode 100644
index 00000000..e3883520
--- /dev/null
+++ b/tests/docroot/www/prefix.fcgi
@@ -0,0 +1,3 @@
+<?php
+echo $_SERVER[$_GET["var"]];
+?>
diff --git a/tests/mod-cgi.t b/tests/mod-cgi.t
index 8b48ae5d..fbfe3f70 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 => 9;
+use Test::More tests => 12;
use LightyTest;
my $tf = LightyTest->new();
@@ -69,6 +69,30 @@ EOF
$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } );
ok($tf->handle_http($t) == 0, 'cgi-env: HTTP_HOST');
+$t->{REQUEST} = ( <<EOF
+GET /get-header.pl?HTTP_HOST HTTP/1.0
+Host: www.example.org
+EOF
+ );
+$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } );
+ok($tf->handle_http($t) == 0, 'cgi-env: HTTP_HOST');
+
+$t->{REQUEST} = ( <<EOF
+GET /get-header.pl?HTTP_HOST HTTP/1.0
+Host: www.example.org
+EOF
+ );
+$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Type' => 'text/plain' } );
+ok($tf->handle_http($t) == 0, 'cgi-env: HTTP_HOST');
+
+$t->{REQUEST} = ( <<EOF
+GET /get-header.pl?HTTP_HOST HTTP/1.1
+Host: www.example.org
+Connection: close
+EOF
+ );
+$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, '+Content-Length' => '' } );
+ok($tf->handle_http($t) == 0, 'cgi-env: HTTP_HOST');
ok($tf->stop_proc == 0, "Stopping lighttpd");