Mercurial > hg > nginx-tests
annotate proxy_cookie_flags.t @ 1982:fb25cbe9d4ec
Tests: explicit Valgrind support.
Valgrind logging is done to a separate file, as it is not able to
follow stderr redirection within nginx or append to a file without
corrupting it. Further, Valgrind logging seems to interfere with
error suppression in tests, and catches various startup errors and
warnings, so the log is additionally filtered.
Since startup under Valgrind can be really slow, timeout in waitforfile()
was changed to 10 seconds.
Prodded by Robert Mueller.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 31 May 2024 06:23:00 +0300 |
parents | 5ac6efbe5552 |
children |
rev | line source |
---|---|
1594
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for the proxy_cookie_flags directive. |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 ############################################################################### |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 select STDERR; $| = 1; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 select STDOUT; $| = 1; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 my $t = Test::Nginx->new()->has(qw/http proxy rewrite/); |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
26 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 $t->write_file_expand('nginx.conf', <<'EOF'); |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 %%TEST_GLOBALS%% |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 daemon off; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 events { |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 } |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 http { |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 %%TEST_GLOBALS_HTTP%% |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 server { |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 listen 127.0.0.1:8080; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 server_name localhost; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 location / { |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 proxy_pass http://127.0.0.1:8081; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 proxy_cookie_flags a secure httponly samesite=none; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 proxy_cookie_flags b secure httponly samesite=lax; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 proxy_cookie_flags c secure httponly samesite=strict; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 proxy_cookie_flags d nosecure nohttponly nosamesite; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 proxy_cookie_flags $arg_complex secure; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 proxy_cookie_flags ~BAR httponly; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 location /off/ { |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 proxy_pass http://127.0.0.1:8081; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 proxy_cookie_flags off; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 } |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 } |
1658
3b8a9f02d141
Tests: proxy_cookie_flags with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1594
diff
changeset
|
59 |
3b8a9f02d141
Tests: proxy_cookie_flags with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1594
diff
changeset
|
60 location /var/ { |
3b8a9f02d141
Tests: proxy_cookie_flags with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1594
diff
changeset
|
61 proxy_pass http://127.0.0.1:8081; |
3b8a9f02d141
Tests: proxy_cookie_flags with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1594
diff
changeset
|
62 proxy_cookie_flags $arg_v $arg_f1 $arg_f2 $arg_f3; |
3b8a9f02d141
Tests: proxy_cookie_flags with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1594
diff
changeset
|
63 } |
1594
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 } |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
66 server { |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
67 listen 127.0.0.1:8081; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
68 server_name localhost; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
70 location / { |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
71 set $c "$arg_v$arg_complex=path=domain=; Domain=example.org$arg_f"; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
72 add_header Set-Cookie $c; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
73 return 200 OK; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
74 } |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 } |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 } |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
77 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
78 EOF |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
79 |
1693
5ac6efbe5552
Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1658
diff
changeset
|
80 $t->run()->plan(14); |
1594
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
81 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
82 ############################################################################### |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
83 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
84 is(http_get_set_cookie('/?v=a'), |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
85 'a=path=domain=; Domain=example.org; Secure; HttpOnly; SameSite=None', |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
86 'flags set all'); |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
87 is(http_get_set_cookie('/?v=b'), |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
88 'b=path=domain=; Domain=example.org; Secure; HttpOnly; SameSite=Lax', |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
89 'flags set lax'); |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
90 is(http_get_set_cookie('/?v=c'), |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
91 'c=path=domain=; Domain=example.org; Secure; HttpOnly; SameSite=Strict', |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
92 'flags set strict'); |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
93 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
94 # edit already set flags |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
95 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
96 is(http_get_set_cookie('/?v=a&f=;Secure;HttpOnly;SameSite=Lax'), |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
97 'a=path=domain=; Domain=example.org; Secure; HttpOnly; SameSite=None', |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
98 'flags reset all'); |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
99 is(http_get_set_cookie('/?v=b&f=;Secure;HttpOnly;SameSite=None'), |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
100 'b=path=domain=; Domain=example.org; Secure; HttpOnly; SameSite=Lax', |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
101 'flags reset lax'); |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
102 is(http_get_set_cookie('/?v=c&f=;Secure;HttpOnly;SameSite=None'), |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
103 'c=path=domain=; Domain=example.org; Secure; HttpOnly; SameSite=Strict', |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
104 'flags reset strict'); |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
105 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
106 is(http_get_set_cookie('/?v=d&f=;secure;httponly;samesite=lax'), |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
107 'd=path=domain=; Domain=example.org', |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
108 'flags remove'); |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
109 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
110 is(http_get_set_cookie('/?v=nx&f=;samesite=none'), |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
111 'nx=path=domain=; Domain=example.org;samesite=none', 'flags no match'); |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
112 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
113 is(http_get_set_cookie('/?complex=v'), |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
114 'v=path=domain=; Domain=example.org; Secure', 'flags variable'); |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
115 is(http_get_set_cookie('/?v=foobarbaz'), |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
116 'foobarbaz=path=domain=; Domain=example.org; HttpOnly', 'flags regex'); |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
117 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
118 is(http_get_set_cookie('/off/?v=a'), 'a=path=domain=; Domain=example.org', |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
119 'flags off'); |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
120 |
1658
3b8a9f02d141
Tests: proxy_cookie_flags with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1594
diff
changeset
|
121 # variables in flags |
3b8a9f02d141
Tests: proxy_cookie_flags with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1594
diff
changeset
|
122 |
3b8a9f02d141
Tests: proxy_cookie_flags with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1594
diff
changeset
|
123 is(http_get_set_cookie('/var/?v=v&f1=secure&f2=httponly&f3=samesite=none'), |
3b8a9f02d141
Tests: proxy_cookie_flags with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1594
diff
changeset
|
124 'v=path=domain=; Domain=example.org; Secure; HttpOnly; SameSite=None', |
3b8a9f02d141
Tests: proxy_cookie_flags with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1594
diff
changeset
|
125 'flags set'); |
3b8a9f02d141
Tests: proxy_cookie_flags with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1594
diff
changeset
|
126 is(http_get_set_cookie('/var/?v=v&f=;Secure;HttpOnly;SameSite=Lax' . |
3b8a9f02d141
Tests: proxy_cookie_flags with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1594
diff
changeset
|
127 '&f1=secure&f2=httponly&f3=samesite=none'), |
3b8a9f02d141
Tests: proxy_cookie_flags with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1594
diff
changeset
|
128 'v=path=domain=; Domain=example.org; Secure; HttpOnly; SameSite=None', |
3b8a9f02d141
Tests: proxy_cookie_flags with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1594
diff
changeset
|
129 'flags reset'); |
3b8a9f02d141
Tests: proxy_cookie_flags with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1594
diff
changeset
|
130 is(http_get_set_cookie('/var/?v=v&f=;secure;httponly;samesite=lax' . |
3b8a9f02d141
Tests: proxy_cookie_flags with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1594
diff
changeset
|
131 '&f1=nosecure&f2=nohttponly&f3=nosamesite'), |
3b8a9f02d141
Tests: proxy_cookie_flags with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1594
diff
changeset
|
132 'v=path=domain=; Domain=example.org', |
3b8a9f02d141
Tests: proxy_cookie_flags with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1594
diff
changeset
|
133 'flags remove'); |
3b8a9f02d141
Tests: proxy_cookie_flags with variables.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1594
diff
changeset
|
134 |
1594
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
135 ############################################################################### |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
136 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
137 sub http_get_set_cookie { |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
138 my ($uri) = @_; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
139 http_get($uri) =~ /^Set-Cookie:\s(.+?)\x0d?$/mi; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
140 return $1; |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
141 } |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
142 |
2083b4f183e7
Tests: proxy_cookie_flags tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
143 ############################################################################### |