Mercurial > hg > nginx-tests
changeset 495:eaf287a41f08
Tests: added X-Accel-Redirect test with named location.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 13 Nov 2014 13:32:48 +0300 |
parents | 623863fcb1d1 |
children | d13ea470657d |
files | proxy_xar.t |
diffstat | 1 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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'); + +} + ###############################################################################