doc: Documented X-Ash-Content-Type for sendfile.
[ashd.git] / doc / sendfile.doc
index b2e3c9a..a958030 100644 (file)
@@ -7,19 +7,31 @@ sendfile - Static file handler for ashd(7)
 
 SYNOPSIS
 --------
-*sendfile* [*-c* 'CONTENT-TYPE'] 'METHOD' 'URL' 'REST'
+*sendfile* [*-c* 'CONTENT-TYPE'] [*-f* 'FILE'] 'METHOD' 'URL' 'REST'
 
 DESCRIPTION
 -----------
 
 *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.
+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
@@ -29,8 +41,11 @@ your system has support for such attributes), the attributes
 present on the file in question, its value will be used instead of
 using *libmagic*.
 
-*sendfile* also handles HTTP caching by supporting the `Last-Modified`
-and related headers.
+*sendfile* supports the following HTTP features:
+
+ * Caching, using the `Last-Modified` and related headers.
+
+ * Partial content, using the `Range` and related headers.
 
 OPTIONS
 -------
@@ -40,6 +55,11 @@ OPTIONS
        Sends 'CONTENT-TYPE' as the file's MIME-type instead of trying
        to auto-detect the file type.
 
+*-f* 'FILE'::
+
+       Ignore the `X-Ash-File` header and force 'FILE' to be served
+       instead. Any remaining rest string is also ignored.
+
 AUTHOR
 ------
 Fredrik Tolf <fredrik@dolda2000.com>