diff options
Diffstat (limited to 'tests/request.t')
-rwxr-xr-x | tests/request.t | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/tests/request.t b/tests/request.t index c4bd9581..93589751 100755 --- a/tests/request.t +++ b/tests/request.t @@ -8,7 +8,7 @@ BEGIN { use strict; use IO::Socket; -use Test::More tests => 46; +use Test::More tests => 52; use LightyTest; my $tf = LightyTest->new(); @@ -429,5 +429,61 @@ EOF $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; ok($tf->handle_http($t) == 0, 'static file with forbidden pathinfo'); + +print "\nConnection header\n"; +$t->{REQUEST} = ( <<EOF +GET /12345.txt HTTP/1.1 +Connection : close +Host: 123.example.org +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ]; +ok($tf->handle_http($t) == 0, 'Connection-header, spaces before ":"'); + +$t->{REQUEST} = ( <<EOF +GET /12345.txt HTTP/1.1 +Connection: ,close +Host: 123.example.org +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ]; +ok($tf->handle_http($t) == 0, 'Connection-header, leading comma'); + +$t->{REQUEST} = ( <<EOF +GET /12345.txt HTTP/1.1 +Connection: close,,TE +Host: 123.example.org +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ]; +ok($tf->handle_http($t) == 0, 'Connection-header, no value between two commas'); + +$t->{REQUEST} = ( <<EOF +GET /12345.txt HTTP/1.1 +Connection: close, ,TE +Host: 123.example.org +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ]; +ok($tf->handle_http($t) == 0, 'Connection-header, space between two commas'); + +$t->{REQUEST} = ( <<EOF +GET /12345.txt HTTP/1.1 +Connection: close, +Host: 123.example.org +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ]; +ok($tf->handle_http($t) == 0, 'Connection-header, comma after value'); + +$t->{REQUEST} = ( <<EOF +GET /12345.txt HTTP/1.1 +Connection: close, +Host: 123.example.org +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ]; +ok($tf->handle_http($t) == 0, 'Connection-header, comma and space after value'); + ok($tf->stop_proc == 0, "Stopping lighttpd"); |