comparison http_disable_symlinks.t @ 204:d838248b643a

Tests: more disable_symlinks tests.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 14 Feb 2012 23:08:18 +0400
parents b6a4770e47ea
children 606a4df68952
comparison
equal deleted inserted replaced
203:b6a4770e47ea 204:d838248b643a
87 alias ///%%TESTDIR%%//./cached/..//; 87 alias ///%%TESTDIR%%//./cached/..//;
88 } 88 }
89 89
90 location ~ (.+/)tail$ { 90 location ~ (.+/)tail$ {
91 disable_symlinks on; 91 disable_symlinks on;
92 alias %%TESTDIR%%/$1;
93 }
94
95 location ~ (.+/)tailowner$ {
96 disable_symlinks if_not_owner;
97 alias %%TESTDIR%%/$1;
98 }
99
100 location ~ (.+/)tailoff$ {
101 disable_symlinks off;
92 alias %%TESTDIR%%/$1; 102 alias %%TESTDIR%%/$1;
93 } 103 }
94 104
95 location /dir { 105 location /dir {
96 disable_symlinks on; 106 disable_symlinks on;
147 my $d = $t->testdir(); 157 my $d = $t->testdir();
148 158
149 plan(skip_all => 'cannot test under symlink') 159 plan(skip_all => 'cannot test under symlink')
150 if $d ne realpath($d); 160 if $d ne realpath($d);
151 161
152 $t->plan(23); 162 $t->plan(25);
153 163
154 mkdir("$d/on"); 164 mkdir("$d/on");
155 mkdir("$d/not_owner"); 165 mkdir("$d/not_owner");
156 mkdir("$d/try_on"); 166 mkdir("$d/try_on");
157 mkdir("$d/try_not_owner"); 167 mkdir("$d/try_not_owner");
234 244
235 like(http_get('/complex/1/empty.html'), qr!200 OK!, 'complex root 1'); 245 like(http_get('/complex/1/empty.html'), qr!200 OK!, 'complex root 1');
236 like(http_get('/complex/2/empty.html'), qr!200 OK!, 'complex root 2'); 246 like(http_get('/complex/2/empty.html'), qr!200 OK!, 'complex root 2');
237 like(http_get('/complex/3/empty.html'), qr!200 OK!, 'complex root 3'); 247 like(http_get('/complex/3/empty.html'), qr!200 OK!, 'complex root 3');
238 248
239 like(http_get('/link/tail'), qr!403 !, 'file with trailing /'); 249 like(http_get('/link/tail'), qr!403 !, 'file with trailing /, on');
250 like(http_get('/link/tailowner'), qr!404 !, 'file with trailing /, owner');
251 like(http_get('/link/tailoff'), qr!404 !, 'file with trailing /, off');
252
240 like(http_get('/dirlink'), qr!404 !, 'directory without /'); 253 like(http_get('/dirlink'), qr!404 !, 'directory without /');
241 like(http_get('/dirlink/'), qr!404 !, 'directory with trailing /'); 254 like(http_get('/dirlink/'), qr!404 !, 'directory with trailing /');
242 255
243 ############################################################################### 256 ###############################################################################
244 257