# HG changeset patch # User Maxim Dounin # Date 1329234104 -14400 # Node ID b6a4770e47ea0d44197856b7cef83bfc127bf9d5 # Parent 067b6cb4793d307467f320faf40119f59f0e8ca0 Tests: disable_symlinks tests for complex cases. diff --git a/http_disable_symlinks.t b/http_disable_symlinks.t --- a/http_disable_symlinks.t +++ b/http_disable_symlinks.t @@ -71,6 +71,31 @@ http { 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 @@ my $d = $t->testdir(); 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($extfile, "$d/if_on/link2"); 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-if-not 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 {