# HG changeset patch # User Sergey Kandaurov # Date 1415874768 -10800 # Node ID eaf287a41f08e46ec9518e590a22ebdb073842bb # Parent 623863fcb1d1a2a6ba932d05df876f4a5c2bc734 Tests: added X-Accel-Redirect test with named location. diff -r 623863fcb1d1 -r eaf287a41f08 proxy_xar.t --- a/proxy_xar.t Fri Nov 07 15:20:02 2014 +0300 +++ b/proxy_xar.t Thu Nov 13 13:32:48 2014 +0300 @@ -21,7 +21,7 @@ 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 @@ 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 @@ return 204; } + location @named { + return 200 "named xar: $upstream_http_x_accel_redirect uri: $uri"; + } } } @@ -99,4 +103,12 @@ 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'); + +} + ###############################################################################