summaryrefslogtreecommitdiff
path: root/tests/request.t
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2021-02-25 21:42:59 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2021-03-02 10:14:25 -0500
commitcc35c03c3cf8791d00d526eebc2fa5d5f748aec1 (patch)
tree8d46f2fc2dcdf9844e324d1e2e6f8bf2413e48c6 /tests/request.t
parentd68e639b7112004cbca381692385a16a1897b224 (diff)
downloadlighttpd-git-cc35c03c3cf8791d00d526eebc2fa5d5f748aec1.tar.gz
[core] RFC 7233 Range handling for non-streaming
RFC 7233 Range handling for all non-streaming responses, including (non-streaming) dynamic responses (previously Range responses handled only for static files)
Diffstat (limited to 'tests/request.t')
-rwxr-xr-xtests/request.t21
1 files changed, 15 insertions, 6 deletions
diff --git a/tests/request.t b/tests/request.t
index bba4b938..432bb51e 100755
--- a/tests/request.t
+++ b/tests/request.t
@@ -8,7 +8,7 @@ BEGIN {
use strict;
use IO::Socket;
-use Test::More tests => 53;
+use Test::More tests => 54;
use LightyTest;
my $tf = LightyTest->new();
@@ -300,15 +300,14 @@ Range: bytes=0-1,97-98
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 206, 'HTTP-Content' => <<EOF
-\r
--fkj49sn38dcn3\r
-Content-Range: bytes 0-1/100\r
Content-Type: text/plain\r
+Content-Range: bytes 0-1/100\r
\r
12\r
--fkj49sn38dcn3\r
-Content-Range: bytes 97-98/100\r
Content-Type: text/plain\r
+Content-Range: bytes 97-98/100\r
\r
hi\r
--fkj49sn38dcn3--\r
@@ -320,10 +319,20 @@ $t->{REQUEST} = ( <<EOF
GET /12345.txt HTTP/1.1
Host: 123.example.org
Connection: close
+Range: bytes=0-
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 206, 'Content-Range' => 'bytes 0-5/6' } ];
+ok($tf->handle_http($t) == 0, 'GET, Range 0-');
+
+$t->{REQUEST} = ( <<EOF
+GET /12345.txt HTTP/1.1
+Host: 123.example.org
+Connection: close
Range: bytes=0--
EOF
);
-$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ];
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 416 } ];
ok($tf->handle_http($t) == 0, 'GET, Range 0--');
$t->{REQUEST} = ( <<EOF
@@ -333,7 +342,7 @@ Connection: close
Range: bytes=-2-3
EOF
);
-$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ];
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 416 } ];
ok($tf->handle_http($t) == 0, 'GET, Range -2-3');
$t->{REQUEST} = ( <<EOF