Closed Brikaa closed 1 year ago
The handler must be defined on an HTTP location that ends in a /
. Then the path info does not contain the leading /
. This works well if you use http:location/3 to define virtual paths and then define the handler on alias(.)
. If you do not use the alias mechanism you need e.g., http_handler('/files/', ...
I don't really see how drive letters end up there. They shouldn't.
Thanks, that was the problem. This leads to inconsistent behavior between Windows and Linux though when there is no trailing backslash in the code. But I am not sure if that would be the code author's problem or a problem that should be handled here.
Should probably be documented explicitly.
When using
http_reply_from_files
with a file specified in the URL on Linux, it gives a permission error. This is becausehttp_safe_file
is called onPathInfo
which has a leading slash; making it think it is an absolute path. The reason this works on Windows is probably because absolute file paths do not start with leading slashes.