Mercurial > hg > nginx-tests
comparison auth_request.t @ 1771:83ec64929612
Tests: tests for multiple WWW-Authenticate headers (ticket #485).
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 30 May 2022 21:37:05 +0300 |
parents | 856ab7671404 |
children |
comparison
equal
deleted
inserted
replaced
1770:ce4419d32383 | 1771:83ec64929612 |
---|---|
23 select STDERR; $| = 1; | 23 select STDERR; $| = 1; |
24 select STDOUT; $| = 1; | 24 select STDOUT; $| = 1; |
25 | 25 |
26 my $t = Test::Nginx->new() | 26 my $t = Test::Nginx->new() |
27 ->has(qw/http rewrite proxy cache fastcgi auth_basic auth_request/) | 27 ->has(qw/http rewrite proxy cache fastcgi auth_basic auth_request/) |
28 ->plan(19); | 28 ->plan(20); |
29 | 29 |
30 $t->write_file_expand('nginx.conf', <<'EOF'); | 30 $t->write_file_expand('nginx.conf', <<'EOF'); |
31 | 31 |
32 %%TEST_GLOBALS%% | 32 %%TEST_GLOBALS%% |
33 | 33 |
125 proxy_pass http://127.0.0.1:8080/auth-basic; | 125 proxy_pass http://127.0.0.1:8080/auth-basic; |
126 proxy_pass_request_body off; | 126 proxy_pass_request_body off; |
127 proxy_set_header Content-Length ""; | 127 proxy_set_header Content-Length ""; |
128 proxy_cache NAME; | 128 proxy_cache NAME; |
129 proxy_cache_valid 1m; | 129 proxy_cache_valid 1m; |
130 } | |
131 | |
132 location /proxy-multi { | |
133 auth_request /auth-proxy-multi; | |
134 } | |
135 location = /auth-proxy-multi { | |
136 proxy_pass http://127.0.0.1:8080/auth-multi; | |
137 proxy_pass_request_body off; | |
138 proxy_set_header Content-Length ""; | |
139 } | |
140 location = /auth-multi { | |
141 add_header WWW-Authenticate foo always; | |
142 add_header WWW-Authenticate bar always; | |
143 return 401; | |
130 } | 144 } |
131 | 145 |
132 location /fastcgi { | 146 location /fastcgi { |
133 auth_request /auth-fastcgi; | 147 auth_request /auth-fastcgi; |
134 } | 148 } |
185 # with proxy_cache or proxy_store, but they will shutdown client connection | 199 # with proxy_cache or proxy_store, but they will shutdown client connection |
186 # in case of header_only and hence do not work for us at all. | 200 # in case of header_only and hence do not work for us at all. |
187 | 201 |
188 like(http_post_big('/proxy-double'), qr/ 204 /, 'proxy auth with body read'); | 202 like(http_post_big('/proxy-double'), qr/ 204 /, 'proxy auth with body read'); |
189 | 203 |
204 # Multiple WWW-Authenticate headers (ticket #485). | |
205 | |
206 TODO: { | |
207 local $TODO = 'not yet' unless $t->has_version('1.23.0'); | |
208 | |
209 like(http_get('/proxy-multi-auth'), qr/WWW-Authenticate: foo.*bar/s, | |
210 'multiple www-authenticate headers'); | |
211 | |
212 } | |
213 | |
190 SKIP: { | 214 SKIP: { |
191 eval { require FCGI; }; | 215 eval { require FCGI; }; |
192 skip 'FCGI not installed', 2 if $@; | 216 skip 'FCGI not installed', 2 if $@; |
193 skip 'win32', 2 if $^O eq 'MSWin32'; | 217 skip 'win32', 2 if $^O eq 'MSWin32'; |
194 | 218 |