Install the library headers.
[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
3d0adcf9
FT
29If a MIME-type is not explicitly specified, *sendfile* uses
30*libmagic*(3) to determine the MIME-type automatically. If *sendfile*
31is compiled with support for filesystem attributes (see *attr*(5) if
32your 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
35present on the file in question, its value will be used instead of
36using *libmagic*.
37
cbc5f085
FT
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.
3d0adcf9
FT
43
44OPTIONS
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
1c273e0d
FT
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
3d0adcf9
FT
57AUTHOR
58------
59Fredrik Tolf <fredrik@dolda2000.com>
60
61SEE ALSO
62--------
63*dirplex*(1), *ashd*(7)