comparison proxy_cache_vary.t @ 1770:ce4419d32383

Tests: tests for multiple Vary headers (ticket #1423).
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 30 May 2022 21:35:56 +0300
parents 5ac6efbe5552
children
comparison
equal deleted inserted replaced
1769:735226e4c7fe 1770:ce4419d32383
20 20
21 select STDERR; $| = 1; 21 select STDERR; $| = 1;
22 select STDOUT; $| = 1; 22 select STDOUT; $| = 1;
23 23
24 my $t = Test::Nginx->new()->has(qw/http proxy cache gzip rewrite/) 24 my $t = Test::Nginx->new()->has(qw/http proxy cache gzip rewrite/)
25 ->plan(49)->write_file_expand('nginx.conf', <<'EOF'); 25 ->plan(52)->write_file_expand('nginx.conf', <<'EOF');
26 26
27 %%TEST_GLOBALS%% 27 %%TEST_GLOBALS%%
28 28
29 daemon off; 29 daemon off;
30 30
91 location /complex { 91 location /complex {
92 gzip off; 92 gzip off;
93 add_header Vary ",, Accept-encoding , ,"; 93 add_header Vary ",, Accept-encoding , ,";
94 } 94 }
95 95
96 location /multi {
97 gzip off;
98 add_header Vary Accept-Encoding;
99 add_header Vary Foo;
100 }
101
96 location /cold { 102 location /cold {
97 expires max; 103 expires max;
98 add_header Vary $arg_vary; 104 add_header Vary $arg_vary;
99 add_header Xtra $arg_xtra; 105 add_header Xtra $arg_xtra;
100 } 106 }
104 EOF 110 EOF
105 111
106 $t->write_file('index.html', 'SEE-THIS'); 112 $t->write_file('index.html', 'SEE-THIS');
107 $t->write_file('asterisk', 'SEE-THIS'); 113 $t->write_file('asterisk', 'SEE-THIS');
108 $t->write_file('complex', 'SEE-THIS'); 114 $t->write_file('complex', 'SEE-THIS');
115 $t->write_file('multi', 'SEE-THIS');
109 $t->write_file('cold', 'SEE-THIS'); 116 $t->write_file('cold', 'SEE-THIS');
110 117
111 $t->run(); 118 $t->run();
112 119
113 ############################################################################### 120 ###############################################################################
253 260
254 like(get('/', 'bar,foo'), qr/HIT/ms, 'normalize order'); 261 like(get('/', 'bar,foo'), qr/HIT/ms, 'normalize order');
255 262
256 } 263 }
257 264
265 # Multiple Vary headers (ticket #1423).
266
267 like(get('/multi', 'foo'), qr/MISS/ms, 'multi first');
268 like(get('/multi', 'foo'), qr/HIT/ms, 'multi second');
269
270 TODO: {
271 local $TODO = 'not yet' unless $t->has_version('1.23.0');
272
273 like(get('/multi', 'bar'), qr/MISS/ms, 'multi other');
274
275 }
276
258 # keep c->body_start when Vary changes (ticket #2029) 277 # keep c->body_start when Vary changes (ticket #2029)
259 278
260 # before 1.19.3, this prevented updating c->body_start of a main key 279 # before 1.19.3, this prevented updating c->body_start of a main key
261 # triggering "cache file .. has too long header" critical errors 280 # triggering "cache file .. has too long header" critical errors
262 281