# HG changeset patch # User Sergey Kandaurov # Date 1415874768 -10800 # Node ID eaf287a41f08e46ec9518e590a22ebdb073842bb # Parent 623863fcb1d1a2a6ba932d05df876f4a5c2bc734 Tests: added X-Accel-Redirect test with named location. diff --git a/proxy_xar.t b/proxy_xar.t --- a/proxy_xar.t +++ b/proxy_xar.t @@ -21,7 +21,7 @@ use Test::Nginx; select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(14); +my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(15); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -39,7 +39,8 @@ http { listen 127.0.0.1:8080; server_name localhost; - # catch safe and unhandled unsafe URIs + # catch safe and unhandled unsafe URIs, + # bypassed with redirect to named location if ($upstream_http_x_accel_redirect) { return 200 "xar: $upstream_http_x_accel_redirect uri: $uri"; } @@ -65,6 +66,9 @@ http { return 204; } + location @named { + return 200 "named xar: $upstream_http_x_accel_redirect uri: $uri"; + } } } @@ -99,4 +103,12 @@ unlike(http_get('/proxy?xar=/foo/.%2e'), like(http_get('/proxy?xar=/foo%20bar'), qr/uri: \/foo bar/, 'X-Accel-Redirect unescaped'); +TODO: { +local $TODO = 'not yet' unless $t->has_version('1.7.8'); + +like(http_get('/proxy?xar=@named'), + qr!200 OK.*named xar: \@named uri: /proxy!s, 'in named location'); + +} + ###############################################################################