Mercurial > hg > nginx-tests
diff auth_request.t @ 508:4ac60aad723e
Tests: test for auth request with proxy cache.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 04 Dec 2014 19:18:45 +0300 |
parents | e7647a966212 |
children | 907e89fba9c3 |
line wrap: on
line diff
--- a/auth_request.t Tue Dec 02 21:08:34 2014 +0300 +++ b/auth_request.t Thu Dec 04 19:18:45 2014 +0300 @@ -24,8 +24,8 @@ select STDOUT; $| = 1; my $t = Test::Nginx->new() - ->has(qw/http rewrite proxy fastcgi auth_basic auth_request/) - ->plan(17); + ->has(qw/http rewrite proxy cache fastcgi auth_basic auth_request/) + ->plan(19); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -39,6 +39,9 @@ http { %%TEST_GLOBALS_HTTP%% + proxy_cache_path %%TESTDIR%%/cache levels=1:2 + keys_zone=NAME:1m; + server { listen 127.0.0.1:8080; server_name localhost; @@ -115,6 +118,17 @@ proxy_set_header Content-Length ""; } + location /proxy-cache { + auth_request /auth-proxy-cache; + } + location = /auth-proxy-cache { + proxy_pass http://127.0.0.1:8080/auth-basic; + proxy_pass_request_body off; + proxy_set_header Content-Length ""; + proxy_cache NAME; + proxy_cache_valid 1m; + } + location /fastcgi { auth_request /auth-fastcgi; } @@ -154,6 +168,15 @@ like(http_post('/proxy'), qr/ 401 /, 'proxy auth post'); +TODO: { +local $TODO = 'not yet' unless $t->has_version('1.7.3'); + +like(http_get_auth('/proxy-cache'), qr/ 404 /, 'proxy auth with cache'); + +} + +like(http_get('/proxy-cache'), qr/ 404 /, 'proxy auth cached'); + # Consider the following scenario: # # 1. proxy_pass reads request body, then goes to fallback via error_page