summaryrefslogtreecommitdiff
path: root/tests/core.t
diff options
context:
space:
mode:
Diffstat (limited to 'tests/core.t')
-rwxr-xr-xtests/core.t32
1 files changed, 31 insertions, 1 deletions
diff --git a/tests/core.t b/tests/core.t
index 6d11cc6..d8187dd 100755
--- a/tests/core.t
+++ b/tests/core.t
@@ -9,7 +9,7 @@ BEGIN {
use strict;
use IO::Socket;
-use Test::More tests => 17;
+use Test::More tests => 21;
use LightyTest;
my $tf = LightyTest->new();
@@ -32,6 +32,36 @@ $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
ok($tf->handle_http($t) == 0, 'missing Protocol');
$t->{REQUEST} = ( <<EOF
+GET / HTTP/01.01
+Host: foo
+Connection: close
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ];
+ok($tf->handle_http($t) == 0, 'zeros in protocol version');
+
+$t->{REQUEST} = ( <<EOF
+GET / HTTP/.01
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
+ok($tf->handle_http($t) == 0, 'missing major version');
+
+$t->{REQUEST} = ( <<EOF
+GET / HTTP/01.
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
+ok($tf->handle_http($t) == 0, 'missing minor version');
+
+$t->{REQUEST} = ( <<EOF
+GET / HTTP/a.b
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
+ok($tf->handle_http($t) == 0, 'strings as version');
+
+$t->{REQUEST} = ( <<EOF
BC /
EOF
);