# HG changeset patch # User Sergey Kandaurov # Date 1437991301 -10800 # Node ID bc91b86a71ee7c462e608794847fb5b352e8a701 # Parent 40675bfad7d3d20de3197431eee7d8e72eb18c6b Tests: added test for try_files in regex location with alias. It was broken by c985d90a8d1f. diff --git a/http_try_files.t b/http_try_files.t --- a/http_try_files.t +++ b/http_try_files.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(8) +my $t = Test::Nginx->new()->has(qw/http proxy rewrite/)->plan(9) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -66,6 +66,11 @@ http { try_files /directory =404; } + location ~ /alias_re.html { + alias %%TESTDIR%%/directory; + try_files $uri =404; + } + location /fallback { proxy_pass http://127.0.0.1:8081/fallback; } @@ -88,6 +93,7 @@ http { EOF mkdir($t->testdir() . '/directory'); +$t->write_file('directory/alias_re.html', 'SEE THIS'); $t->write_file('found.html', 'SEE THIS'); $t->run(); @@ -103,4 +109,11 @@ like(http_get('/file-dir/'), qr!404 Not! like(http_get('/dir-dir/'), qr!301 Moved Permanently!, 'dir matches dir'); like(http_get('/dir-file/'), qr!404 Not!, 'dir does not match file'); +SKIP: { +skip 'leaves coredump', 1 unless $ENV{TEST_NGINX_UNSAFE}; + +like(http_get('/alias_re.html'), qr!SEE THIS!, 'alias in regex location'); + +} + ###############################################################################