Mercurial > hg > nginx-tests
diff slice.t @ 1007:174e900c00dc
Tests: adjusted slice.t to test with various range header lengths.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Fri, 19 Aug 2016 18:15:57 +0300 |
parents | 882267679006 |
children | 196d33c2bb45 |
line wrap: on
line diff
--- a/slice.t +++ b/slice.t @@ -90,7 +90,7 @@ http { EOF -$t->write_file('t', '012345678'); +$t->write_file('t', '0123456789abcdef'); $t->run(); ############################################################################### @@ -98,7 +98,7 @@ EOF my $r; like(http_get('/cache/nx'), qr/ 404 /, 'not found'); -like(http_get('/cache/t'), qr/ 200 .*012345678$/ms, 'no range'); +like(http_get('/cache/t'), qr/ 200 .*0123456789abcdef$/ms, 'no range'); $r = get('/cache/t?single', "Range: bytes=0-0"); like($r, qr/ 206 /, 'single - 206 partial reply'); @@ -169,12 +169,12 @@ like($r, qr/Status: HIT/m, 'range next - $r = get('/cache/t?first', "Range: bytes=2-"); like($r, qr/ 206 /, 'first bytes - 206 partial reply'); -like($r, qr/^2345678$/m, 'first bytes - correct content'); +like($r, qr/^23456789abcdef$/m, 'first bytes - correct content'); like($r, qr/Status: MISS/m, 'first bytes - cache status'); $r = get('/cache/t?first', "Range: bytes=4-"); like($r, qr/ 206 /, 'first bytes cached - 206 partial reply'); -like($r, qr/^45678$/m, 'first bytes cached - correct content'); +like($r, qr/^456789abcdef$/m, 'first bytes cached - correct content'); like($r, qr/Status: HIT/m, 'first bytes cached - cache status'); # multiple ranges @@ -182,11 +182,11 @@ like($r, qr/Status: HIT/m, 'first bytes $r = get('/cache/t?many', "Range: bytes=3-3,4-4"); like($r, qr/200 OK/, 'many - 206 partial reply'); -like($r, qr/^012345678$/m, 'many - correct content'); +like($r, qr/^0123456789abcdef$/m, 'many - correct content'); $r = get('/cache/t?last', "Range: bytes=-10"); -like($r, qr/200 OK/, 'last bytes - 206 partial reply'); -like($r, qr/^012345678$/m, 'last bytes - correct content'); +like($r, qr/206 /, 'last bytes - 206 partial reply'); +like($r, qr/^6789abcdef$/m, 'last bytes - correct content'); # respect not modified and range filters @@ -204,7 +204,7 @@ like($r, qr/^34$/m, 'if-range - correct $r = get('/cache/t?ifb', "Range: bytes=3-4\nIf-Range: bad"); like($r, qr/ 200 /, 'if-range bad - 200 ok'); -like($r, qr/^012345678$/m, 'if-range bad - correct content'); +like($r, qr/^0123456789abcdef$/m, 'if-range bad - correct content'); # first slice isn't known