summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2020-09-04 19:22:56 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2020-10-11 12:19:26 -0400
commita3af9833c6bc341b61b7c5b1e1db81e432250ec2 (patch)
treed61e226b3b40c5b6b2638215e1b23b89fd4185c8 /tests
parent5a694281da40d3fdcd402efb07edcb76f5808ceb (diff)
downloadlighttpd-git-a3af9833c6bc341b61b7c5b1e1db81e432250ec2.tar.gz
[core] fix crash on master if blank line request
(bug on master branch; never released) (thx avij) fix crash on master if blank line precedes HTTP/1.1 keep-alive request header parsing code previously made assumptions that request was HTTP/1.0 or HTTP/1.1, where a request-line was required, and which would error out elsewhere if request-line was missing. The parsing code also previously looked for "\r\n\r\n" to end headers. The header offset parsing code was modified and invalidated the above assumptions, now looking only for blank line "\r\n", but the calling code had not properly been updated. (until this patch)
Diffstat (limited to 'tests')
-rwxr-xr-xtests/core-keepalive.t29
1 files changed, 27 insertions, 2 deletions
diff --git a/tests/core-keepalive.t b/tests/core-keepalive.t
index b4f51f90..a0badc22 100755
--- a/tests/core-keepalive.t
+++ b/tests/core-keepalive.t
@@ -8,7 +8,7 @@ BEGIN {
use strict;
use IO::Socket;
-use Test::More tests => 7;
+use Test::More tests => 9;
use LightyTest;
my $tf = LightyTest->new();
@@ -83,9 +83,34 @@ Host: 123.example.org
Connection: close
EOF
);
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } , { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ];
+ok($tf->handle_http($t) == 0, 'Implicit HTTP/1.1 Keep-Alive');
+
+$t->{REQUEST} = ( <<EOF
+GET /12345.txt HTTP/1.1
+Host: 123.example.org
+
+GET /12345.txt HTTP/1.1
+Host: 123.example.org
+Connection: close
+EOF
+ );
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } , { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ];
+ok($tf->handle_http($t) == 0, 'Implicit HTTP/1.1 Keep-Alive w/ extra blank b/w requests');
-ok($tf->handle_http($t) == 0, 'Implicit HTTP/1.1 Keep-Alive');
+$t->{REQUEST} = ( <<EOF
+GET /12345.txt HTTP/1.1
+Host: 123.example.org
+
+
+
+GET /12345.txt HTTP/1.1
+Host: 123.example.org
+Connection: close
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } , { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
+ok($tf->handle_http($t) == 0, 'Implicit HTTP/1.1 Keep-Alive w/ excess blank b/w requests');
ok($tf->stop_proc == 0, "Stopping lighttpd");