# HG changeset patch # User Sergey Kandaurov # Date 1594372777 -10800 # Node ID ab13e2744d05403c44390bb7d2def1c960fc079f # Parent 463d6863d36045a5a8a4a51609e8fb2225e0921b Tests: added slice filter test for original Accept-Ranges. diff --git a/slice.t b/slice.t --- 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');