| 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 | A 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 |
| 32 | instance, be set using the *set* directives of *dirplex*(1) or |
| 33 | *patplex*(1). |
| 34 | |
| 35 | If a MIME-type is not explicitly specified, *sendfile* uses |
| 36 | *libmagic*(3) to determine the MIME-type automatically. If *sendfile* |
| 37 | is compiled with support for filesystem attributes (see *attr*(5) if |
| 38 | your 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 |
| 41 | present on the file in question, its value will be used instead of |
| 42 | using *libmagic*. |
| 43 | |
| 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. |
| 49 | |
| 50 | OPTIONS |
| 51 | ------- |
| 52 | |
| 53 | *-c* 'CONTENT-TYPE':: |
| 54 | |
| 55 | Send 'CONTENT-TYPE' as the file's MIME-type instead of trying |
| 56 | to auto-detect the file type. |
| 57 | |
| 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 | |
| 63 | AUTHOR |
| 64 | ------ |
| 65 | Fredrik Tolf <fredrik@dolda2000.com> |
| 66 | |
| 67 | SEE ALSO |
| 68 | -------- |
| 69 | *dirplex*(1), *psendfile*(1), *ashd*(7) |