comparison http_disable_symlinks.t @ 577:90f9b128b218

Tests: handled legacy 'darwin' behavior in disable_symlinks tests. Unlike stated in the newer Open Group Base Specifications Issue 7, opening a symlink to the non-directory entry with a trailing slash would succeed in 'darwin'-like systems: [ENOTDIR] <..>the path argument contains at least one non- <slash> character and ends with one or more trailing <slash> characters, and the last pathname component names an existing file that is neither a directory nor a symbolic link to a directory<..> See for details how it was fixed in FreeBSD 7+: http://bugs.freebsd.org/21768
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 18 May 2015 12:05:04 +0300
parents 2cd00179f4b2
children c03af44a7370
comparison
equal deleted inserted replaced
576:239ade56c015 577:90f9b128b218
257 # workaround for freebsd 8: we use O_EXEC instead of O_SEARCH (since there 257 # workaround for freebsd 8: we use O_EXEC instead of O_SEARCH (since there
258 # is no O_SEARCH), and O_DIRECTORY does nothing. setting the 'x' bit 258 # is no O_SEARCH), and O_DIRECTORY does nothing. setting the 'x' bit
259 # tests to pass as openat() will correctly fail with ENOTDIR 259 # tests to pass as openat() will correctly fail with ENOTDIR
260 260
261 chmod(0700, "$d/link"); 261 chmod(0700, "$d/link");
262 my $rc = $^O eq 'darwin' ? 200 : 404;
262 263
263 like(http_get('/link/tail'), qr!40[34] !, 'file with trailing /, on'); 264 like(http_get('/link/tail'), qr!40[34] !, 'file with trailing /, on');
264 like(http_get('/link/tailowner'), qr!404 !, 'file with trailing /, owner'); 265 like(http_get('/link/tailowner'), qr!404 !, 'file with trailing /, owner');
265 like(http_get('/link/tailoff'), qr!404 !, 'file with trailing /, off'); 266 like(http_get('/link/tailoff'), qr!$rc !, 'file with trailing /, off');
266 267
267 like(http_get('/dirlink'), qr!404 !, 'directory without /'); 268 like(http_get('/dirlink'), qr!404 !, 'directory without /');
268 like(http_get('/dirlink/'), qr!404 !, 'directory with trailing /'); 269 like(http_get('/dirlink/'), qr!404 !, 'directory with trailing /');
269 270
270 } # SKIP: cannot test under symlink 271 } # SKIP: cannot test under symlink