[PATCH 09 of 10] Tests: tests for multiple Vary headers (ticket #1423)

Maxim Dounin mdounin at mdounin.ru
Wed Apr 20 22:37:50 UTC 2022


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1650492940 -10800
#      Thu Apr 21 01:15:40 2022 +0300
# Node ID 1688e99291d5c4b6ed5dc7f86333d538acdac2f1
# Parent  c5a73a2d1e3702a194ac7e7d8494acbeaf7cefe7
Tests: tests for multiple Vary headers (ticket #1423).

diff --git a/proxy_cache_vary.t b/proxy_cache_vary.t
--- a/proxy_cache_vary.t
+++ b/proxy_cache_vary.t
@@ -22,7 +22,7 @@ select STDERR; $| = 1;
 select STDOUT; $| = 1;
 
 my $t = Test::Nginx->new()->has(qw/http proxy cache gzip rewrite/)
-	->plan(49)->write_file_expand('nginx.conf', <<'EOF');
+	->plan(52)->write_file_expand('nginx.conf', <<'EOF');
 
 %%TEST_GLOBALS%%
 
@@ -93,6 +93,12 @@ http {
             add_header Vary ",, Accept-encoding , ,";
         }
 
+        location /multi {
+            gzip off;
+            add_header Vary Accept-Encoding;
+            add_header Vary Foo;
+        }
+
         location /cold {
             expires max;
             add_header Vary $arg_vary;
@@ -106,6 +112,7 @@ EOF
 $t->write_file('index.html', 'SEE-THIS');
 $t->write_file('asterisk', 'SEE-THIS');
 $t->write_file('complex', 'SEE-THIS');
+$t->write_file('multi', 'SEE-THIS');
 $t->write_file('cold', 'SEE-THIS');
 
 $t->run();
@@ -255,6 +262,18 @@ like(get('/', 'bar,foo'), qr/HIT/ms, 'no
 
 }
 
+# Multiple Vary headers (ticket #1423).
+
+like(get('/multi', 'foo'), qr/MISS/ms, 'multi first');
+like(get('/multi', 'foo'), qr/HIT/ms, 'multi second');
+
+TODO: {
+local $TODO = 'not yet';
+
+like(get('/multi', 'bar'), qr/MISS/ms, 'multi other');
+
+}
+
 # keep c->body_start when Vary changes (ticket #2029)
 
 # before 1.19.3, this prevented updating c->body_start of a main key



More information about the nginx-devel mailing list