Mercurial > hg > nginx-tests
changeset 203:b6a4770e47ea
Tests: disable_symlinks tests for complex cases.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 14 Feb 2012 19:41:44 +0400 |
parents | 067b6cb4793d |
children | d838248b643a |
files | http_disable_symlinks.t |
diffstat | 1 files changed, 37 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/http_disable_symlinks.t Mon Feb 13 23:53:23 2012 +0400 +++ b/http_disable_symlinks.t Tue Feb 14 19:41:44 2012 +0400 @@ -71,6 +71,31 @@ return 204; } } + + location /complex/1/ { + disable_symlinks on; + alias %%TESTDIR%%/./cached/../; + } + + location /complex/2/ { + disable_symlinks on; + alias %%TESTDIR%%//./cached/..//; + } + + location /complex/3/ { + disable_symlinks on; + alias ///%%TESTDIR%%//./cached/..//; + } + + location ~ (.+/)tail$ { + disable_symlinks on; + alias %%TESTDIR%%/$1; + } + + location /dir { + disable_symlinks on; + try_files $uri/ =404; + } } server { @@ -124,7 +149,7 @@ plan(skip_all => 'cannot test under symlink') if $d ne realpath($d); -$t->plan(17); +$t->plan(23); mkdir("$d/on"); mkdir("$d/not_owner"); @@ -161,6 +186,9 @@ symlink("empty.html", "$d/if_not_owner/link"); symlink($extfile, "$d/if_not_owner/link2"); +mkdir("$d/dir"); +symlink("dir", "$d/dirlink"); + symlink($extfile, "$d/cached/link"); ############################################################################### @@ -204,6 +232,14 @@ like(http_get_host('s2', '/cached-off/link'), qr!200 OK!, 'open_file_cache (pass 5)'); +like(http_get('/complex/1/empty.html'), qr!200 OK!, 'complex root 1'); +like(http_get('/complex/2/empty.html'), qr!200 OK!, 'complex root 2'); +like(http_get('/complex/3/empty.html'), qr!200 OK!, 'complex root 3'); + +like(http_get('/link/tail'), qr!403 !, 'file with trailing /'); +like(http_get('/dirlink'), qr!404 !, 'directory without /'); +like(http_get('/dirlink/'), qr!404 !, 'directory with trailing /'); + ############################################################################### sub http_get_host {