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