From e09064f860692a29a47fb9723bf8bbe728e277b6 Mon Sep 17 00:00:00 2001 From: Vadim Zhestikov Date: Thu, 18 Dec 2025 16:36:45 -0800 Subject: [PATCH] Tests: test RFC6265 valid cookie-pair separator (ticket #1042). --- http_headers_multi.t | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/http_headers_multi.t b/http_headers_multi.t index 28211480..687f3e6b 100644 --- a/http_headers_multi.t +++ b/http_headers_multi.t @@ -23,7 +23,7 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http rewrite proxy/)->plan(42); +my $t = Test::Nginx->new()->has(qw/http rewrite proxy/)->plan(47); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -49,6 +49,7 @@ http { add_header X-Cookie-Foo $cookie_foo; add_header X-Cookie-Bar $cookie_bar; add_header X-Cookie-Bazz $cookie_bazz; + add_header X-Cookie-Qux $cookie_qux; return 204; } @@ -155,6 +156,18 @@ like($r, qr/X-Cookie-Foo: 1/, '$cookie_foo'); like($r, qr/X-Cookie-Bar: 2/, '$cookie_bar'); like($r, qr/X-Cookie-Bazz: 3/, '$cookie_bazz'); +# request cookies, multiple values + +like(get('/', 'Cookie: foo=1, qux=0; bar=2', 'Cookie: bazz=3'), + qr/X-Cookie: foo=1, qux=0; bar=2; bazz=3/, 'multi comma $http_cookie'); + +$r = get('/', 'Cookie: foo=1, qux=0; bar=2', 'Cookie: bazz=3'); + +like($r, qr/X-Cookie-Foo: 1, qux=0/, '$cookie_foo'); +like($r, qr/X-Cookie-Bar: 2/, '$cookie_bar'); +like($r, qr/X-Cookie-Bazz: 3/, '$cookie_bazz'); +unlike($r, qr/X-Cookie-Qux:/, '$cookie_qux'); + # response headers, $http_* $r = get('/s');