Mercurial > hg > nginx-tests
comparison proxy_force_ranges.t @ 1474:f026c41335b2
Tests: range filter and chunked transfer encoding test.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 13 May 2019 21:06:25 +0300 |
parents | 97c8280de681 |
children | 86510f795546 |
comparison
equal
deleted
inserted
replaced
1473:ddbde6c5b0cd | 1474:f026c41335b2 |
---|---|
11 use warnings; | 11 use warnings; |
12 use strict; | 12 use strict; |
13 | 13 |
14 use Test::More; | 14 use Test::More; |
15 | 15 |
16 use Socket qw/ $CRLF /; | |
17 | |
16 BEGIN { use FindBin; chdir($FindBin::Bin); } | 18 BEGIN { use FindBin; chdir($FindBin::Bin); } |
17 | 19 |
18 use lib 'lib'; | 20 use lib 'lib'; |
19 use Test::Nginx; | 21 use Test::Nginx; |
20 | 22 |
21 ############################################################################### | 23 ############################################################################### |
22 | 24 |
23 select STDERR; $| = 1; | 25 select STDERR; $| = 1; |
24 select STDOUT; $| = 1; | 26 select STDOUT; $| = 1; |
25 | 27 |
26 my $t = Test::Nginx->new()->has(qw/http proxy cache/)->plan(6) | 28 my $t = Test::Nginx->new()->has(qw/http proxy cache/)->plan(7) |
27 ->write_file_expand('nginx.conf', <<'EOF'); | 29 ->write_file_expand('nginx.conf', <<'EOF'); |
28 | 30 |
29 %%TEST_GLOBALS%% | 31 %%TEST_GLOBALS%% |
30 | 32 |
31 daemon off; | 33 daemon off; |
48 } | 50 } |
49 | 51 |
50 location /proxy/ { | 52 location /proxy/ { |
51 proxy_pass http://127.0.0.1:8081/; | 53 proxy_pass http://127.0.0.1:8081/; |
52 proxy_force_ranges on; | 54 proxy_force_ranges on; |
55 add_trailer X-Trailer ""; | |
53 } | 56 } |
54 | 57 |
55 location /cache/ { | 58 location /cache/ { |
56 proxy_pass http://127.0.0.1:8081/; | 59 proxy_pass http://127.0.0.1:8081/; |
57 proxy_cache NAME; | 60 proxy_cache NAME; |
102 | 105 |
103 like(http_get_range('/proxy/t.html', | 106 like(http_get_range('/proxy/t.html', |
104 "Range: bytes=4-\nIf-Range: \"59a5401c-8\""), | 107 "Range: bytes=4-\nIf-Range: \"59a5401c-8\""), |
105 qr/^THIS/m, 'if-range etag proxy'); | 108 qr/^THIS/m, 'if-range etag proxy'); |
106 | 109 |
110 # range sent using chunked transfer encoding | |
111 | |
112 TODO: { | |
113 local $TODO = 'not yet'; | |
114 | |
115 like(http_get_range('/proxy/t.html', 'Range: bytes=-2'), | |
116 qr/2${CRLF}IS${CRLF}0$CRLF$CRLF$/, 'no dublicate final chunk'); | |
117 | |
118 } | |
119 | |
107 ############################################################################### | 120 ############################################################################### |
108 | 121 |
109 sub http_get_range { | 122 sub http_get_range { |
110 my ($url, $extra) = @_; | 123 my ($url, $extra) = @_; |
111 return http(<<EOF); | 124 return http(<<EOF); |