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
svn/tags/lighttpd-1.4.2
Jan Kneschke 2005-08-21 23:12:56 +00:00
parent 35d3c10d81
commit b22c094836
3 changed files with 36 additions and 1 deletions

View File

@ -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;

View File

@ -0,0 +1,3 @@
<?php
echo $_SERVER[$_GET["var"]];
?>

View File

@ -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");