Mercurial > hg > nginx-tests
diff slice.t @ 1211:0c15ba7d19b3
Tests: If-Range tests with proxy.
This covers the following cases:
- slice filter and If-Range requests (ticket #1357);
- If-Range requests with proxy_force_ranges;
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 29 Aug 2017 16:56:52 +0300 |
parents | 1173800a4a19 |
children | 766bcbb632ee |
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(74); + ->plan(76); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -50,6 +50,14 @@ http { location / { } + location /proxy/ { + slice 2; + + proxy_pass http://127.0.0.1:8081/; + + proxy_set_header Range $slice_range; + } + location /cache/ { slice 2; @@ -223,6 +231,18 @@ like(get('/cache/t?im', "If-Match: bad") like($r, qr/ 206 /, 'if-range - 206 partial reply'); like($r, qr/^34$/m, 'if-range - correct content'); +# respect Last-Modified from non-cacheable response with If-Range + +TODO: { +local $TODO = 'not yet' unless $t->has_version('1.13.5'); + +my ($lm) = http_get('/t') =~ /Last-Modified: (.*)/; +$r = get('/proxy/t', "Range: bytes=3-4\nIf-Range: $lm"); +like($r, qr/ 206 /, 'if-range last-modified proxy - 206 partial reply'); +like($r, qr/^34$/m, 'if-range last-modified proxy - correct content'); + +} + $r = get('/cache/t?ifb', "Range: bytes=3-4\nIf-Range: bad"); like($r, qr/ 200 /, 'if-range bad - 200 ok'); like($r, qr/^0123456789abcdef$/m, 'if-range bad - correct content');