Browse Source

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 17 years ago
parent
commit
b22c094836
  1. 8
      tests/docroot/www/get-header.pl
  2. 3
      tests/docroot/www/prefix.fcgi
  3. 26
      tests/mod-cgi.t

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

3
tests/docroot/www/prefix.fcgi

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

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

Loading…
Cancel
Save