Table of Contents
sendfile serves static files by sending them exactly as they are to
clients. It needs to be called with the X-Ash-File
header added to
the request, as dirplex(1) does, unless the -f option is given.
sendfile is a transient handler, as defined in ashd(7), and the METHOD, URL and REST arguments will normally be added by the parent handler.
Normally, sendfile will serve the file named by the X-Ash-File
header, and fail with a 404 error in case the rest string is not
empty. However, if the -f argument is given, the given FILE will
always be served instead, and the X-Ash-File
header and any rest
string is ignored.
A file’s MIME type may be specified explicitly either by using the
-c option, or by passing the header X-Ash-Content-Type
to
sendfile with the MIME type of the file. That header might, for
instance, be set using the set directives of dirplex(1) or
patplex(1).
If a MIME-type is not explicitly specified, sendfile uses
libmagic(3) to determine the MIME-type automatically. If sendfile
is compiled with support for filesystem attributes (see attr(5) if
your system has support for such attributes), the attributes
user.ash-mime-type
, user.mime-type
, user.mime_type
or
user.Content-Type
will be checked, in that order, and if one is
present on the file in question, its value will be used instead of
using libmagic.
sendfile supports the following HTTP features:
Last-Modified
and related headers.
Range
and related headers.
X-Ash-File
header and force FILE to be served
instead. Any remaining rest string is also ignored.
Fredrik Tolf <fredrik@dolda2000.com>