# HG changeset patch # User Sergey Kandaurov # Date 1471860596 -10800 # Node ID bab7b53a156f87ec0db6c8b4917792fa04c5dc5e # Parent 174e900c00dc3fe406b1c4f0badbc4045a6f8b99 Tests: proxy cache range with sendfile in threads. diff --git a/proxy_cache_range.t b/proxy_cache_range.t --- a/proxy_cache_range.t +++ b/proxy_cache_range.t @@ -21,7 +21,7 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http proxy cache shmem/)->plan(6) +my $t = Test::Nginx->new()->has(qw/http proxy cache shmem/)->plan(7) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -59,6 +59,9 @@ http { server_name localhost; location / { + if ($arg_s) { + limit_rate 50k; + } } } } @@ -66,6 +69,12 @@ http { EOF $t->write_file('t.html', 'SEE-THIS'); + +# should not fit in a single proxy buffer + +$t->write_file('tbig.html', + join('', map { sprintf "XX%06dXX", $_ } (1 .. 7000))); + $t->run(); ############################################################################### @@ -91,6 +100,15 @@ like(http_get_range('/min_uses/t.html?3' like(http_get_range('/min_uses/t.html?4', 'Range: bytes=0-2,4-'), qr/^SEE.*^THIS/ms, 'multipart range below min_uses'); +TODO: { +local $TODO = 'not yet' if $t->read_file('nginx.conf') =~ /sendfile on/ + and $t->read_file('nginx.conf') =~ /aio threads/ and $^O eq 'linux'; + +like(http_get_range('/tbig.html?s=1', 'Range: bytes=0-19'), + qr/^XX000001XXXX000002XX$/ms, 'range of response received in parts'); + +} + ############################################################################### sub http_get_range {