3c31929daa44eb1811b952b9f478a1385553348a
[ashd.git] / doc / sendfile.doc
1 sendfile(1)
2 ===========
3
4 NAME
5 ----
6 sendfile - Static file handler for ashd(7)
7
8 SYNOPSIS
9 --------
10 *sendfile* [*-c* 'CONTENT-TYPE'] [*-f* 'FILE'] 'METHOD' 'URL' 'REST'
11
12 DESCRIPTION
13 -----------
14
15 *sendfile* serves static files by sending them exactly as they are to
16 clients. It needs to be called with the `X-Ash-File` header added to
17 the request, as *dirplex*(1) does, unless the *-f* option is given.
18
19 *sendfile* is a transient handler, as defined in *ashd*(7), and the
20 'METHOD', 'URL' and 'REST' arguments will normally be added by the
21 parent handler.
22
23 Normally, *sendfile* will serve the file named by the `X-Ash-File`
24 header, and fail with a 404 error in case the rest string is not
25 empty. However, if the *-f* argument is given, the given 'FILE' will
26 always be served instead, and the `X-Ash-File` header and any rest
27 string is ignored.
28
29 If a MIME-type is not explicitly specified, *sendfile* uses
30 *libmagic*(3) to determine the MIME-type automatically. If *sendfile*
31 is compiled with support for filesystem attributes (see *attr*(5) if
32 your system has support for such attributes), the attributes
33 `user.ash-mime-type`, `user.mime-type`, `user.mime_type` or
34 `user.Content-Type` will be checked, in that order, and if one is
35 present on the file in question, its value will be used instead of
36 using *libmagic*.
37
38 *sendfile* supports the following HTTP features:
39
40  * Caching, using the `Last-Modified` and related headers.
41
42  * Partial content, using the `Range` and related headers.
43
44 OPTIONS
45 -------
46
47 *-c* 'CONTENT-TYPE'::
48
49         Sends 'CONTENT-TYPE' as the file's MIME-type instead of trying
50         to auto-detect the file type.
51
52 *-f* 'FILE'::
53
54         Ignore the `X-Ash-File` header and force 'FILE' to be served
55         instead. Any remaining rest string is also ignored.
56
57 AUTHOR
58 ------
59 Fredrik Tolf <fredrik@dolda2000.com>
60
61 SEE ALSO
62 --------
63 *dirplex*(1), *ashd*(7)