Skip to content

Commit e23beaa

Browse files
committed
Tests: tests for multiple Vary headers (ticket #1423).
1 parent fd1303f commit e23beaa

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

proxy_cache_vary.t

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ select STDERR; $| = 1;
2222
select STDOUT; $| = 1;
2323

2424
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');
2626
2727
%%TEST_GLOBALS%%
2828
@@ -93,6 +93,12 @@ http {
9393
add_header Vary ",, Accept-encoding , ,";
9494
}
9595
96+
location /multi {
97+
gzip off;
98+
add_header Vary Accept-Encoding;
99+
add_header Vary Foo;
100+
}
101+
96102
location /cold {
97103
expires max;
98104
add_header Vary $arg_vary;
@@ -106,6 +112,7 @@ EOF
106112
$t->write_file('index.html', 'SEE-THIS');
107113
$t->write_file('asterisk', 'SEE-THIS');
108114
$t->write_file('complex', 'SEE-THIS');
115+
$t->write_file('multi', 'SEE-THIS');
109116
$t->write_file('cold', 'SEE-THIS');
110117

111118
$t->run();
@@ -255,6 +262,18 @@ like(get('/', 'bar,foo'), qr/HIT/ms, 'normalize order');
255262

256263
}
257264

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+
258277
# keep c->body_start when Vary changes (ticket #2029)
259278

260279
# before 1.19.3, this prevented updating c->body_start of a main key

0 commit comments

Comments
 (0)