*stat()-ing symlinks with trailing slashes

Vlad GALU dudu at dudu.ro
Sat May 23 15:33:10 UTC 2009


On Sat, May 23, 2009 at 1:34 PM, Bruce Evans <brde at optusnet.com.au> wrote:
[...]

> ENOTDIR is correct for following a symlink to non-directory (with a
> trailing slash in the pathname).

   Eh, yes, unfortunately it doesn't work like that yet :)

>
> Why does GET give trailing slashes for non-directories?  Trailing
> slashes are most useful interactively for getting symlinks followed
> and for avoiding getting file contents when you "know" that the file
> is a directory (and that the OS handles trailing slashes reasonably).
> Applications shouldn't need this hack since they can use lstat() to
> get more details, and it is still unportable.

   What Mircea had was a symlink, "script.php", pointing to
"/some/other/path/for/script.php" in his wwwroot. Then he sent a GET
request on $httphost/script.php/", to which lighttpd responded with
the full contents of script.php. Unfortunately I haven't looked at
lighty's sources yet to see how they manage the requests.

   Thanks, Bruce, for your input, sharp as always!


More information about the freebsd-fs mailing list