# HG changeset patch # User Sergey Kandaurov # Date 1417709925 -10800 # Node ID 4ac60aad723e4bb22bc323548953413c572c2d96 # Parent 34280f6b0bc6e43415e8f2df5e73420772882b90 Tests: test for auth request with proxy cache. diff --git a/auth_request.t b/auth_request.t --- a/auth_request.t +++ b/auth_request.t @@ -24,8 +24,8 @@ select STDERR; $| = 1; 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 @@ events { 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 @@ http { 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 @@ unlike(http_get_auth('/proxy'), qr/INVIS 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