changeset 1582:ab13e2744d05

Tests: added slice filter test for original Accept-Ranges.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 10 Jul 2020 12:19:37 +0300
parents 463d6863d360
children 8aede7babd9a
files slice.t
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/slice.t
+++ b/slice.t
@@ -23,7 +23,7 @@ select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
 my $t = Test::Nginx->new()->has(qw/http proxy cache fastcgi slice rewrite/)
-	->plan(76);
+	->plan(79);
 
 $t->write_file_expand('nginx.conf', <<'EOF');
 
@@ -109,6 +109,8 @@ http {
         listen       127.0.0.1:8081;
         server_name  localhost;
 
+        add_header Accept-Ranges bytes;
+
         location / {
             if ($http_range = "") {
                 set $limit_rate 100;
@@ -129,6 +131,17 @@ my $r;
 like(http_get('/cache/nx'), qr/ 404 /, 'not found');
 like(http_get('/cache/t'), qr/ 200 .*0123456789abcdef$/ms, 'no range');
 
+$r = get('/proxy/t', 'Range: bytes=3-4');
+like($r, qr/ 206 /, 'proxy - 206 partial reply');
+like($r, qr/^34$/m, 'proxy - correct content');
+
+TODO: {
+local $TODO = 'not yet' unless $t->has_version('1.19.2');
+
+unlike($r, qr/Accept-Ranges/, 'proxy - no original accept-ranges');
+
+}
+
 $r = get('/cache/t?single', "Range: bytes=0-0");
 like($r, qr/ 206 /, 'single - 206 partial reply');
 like($r, qr/^0$/m, 'single - correct content');