doc: Fixed typo.
[ashd.git] / doc / dirplex.doc
index c38ff4a..8a0184f 100644 (file)
@@ -71,7 +71,7 @@ element. If there is such a file, it is considered the result of the
 mapping.
 
 If the result of the mapping procedure is a directory, it is checked
-for the presence of a filed named by the *index-file* configuration
+for the presence of a file named by the *index-file* configuration
 directive (see CONFIGURATION below). If there is such a file, it is
 considered the final result instead of the directory itself. If the
 index file name contains no dots and there is no exact match, then,
@@ -177,7 +177,7 @@ The following configuration directives are recognized:
        program will be started in the same directory as the `.htrc`
        file itself.
 
-*match* [*directory*]::
+*match* ['TYPE']::
 
        Specifies a filename pattern-matching rule. The
        pattern-matching procedure and the follow-up lines accepted by
@@ -193,9 +193,10 @@ The following configuration directives are recognized:
        be a named request handler specified either in the same
        `.htrc` file or elsewhere. The *capture* directive accepts no
        follow-up lines. Note that the `X-Ash-File` header is not
-       added to requests passed via *capture* directives.  If 'FLAGS'
-       contain the character `R`, this *capture* directive will be
-       ignored if it is in the root directory that *dirplex* serves.
+       added to requests passed via *capture* directives. Normally,
+       *capture* directives will be ignored if they appear in the
+       root directory that *dirplex* serves, but not if 'FLAGS'
+       contain the character `D`.
 
 MATCHING
 --------
@@ -209,10 +210,13 @@ ignored.
 
 To match a file, any *match* stanzas specified by any `.htrc` file or
 in the global configuration files are searched in order of their
-"distance" (see CONFIGURATION above) from the actual file. If it is a
-directory which is being considered, only *match* stanzas with the
-*directory* parameter are considered; otherwise, if it is a file, only
-*match* stanzas without the *directory* parameter are considered.
+"distance" (see CONFIGURATION above) from the actual file. Which
+*match* stanzas are considered depends on the type of the file being
+matched: if an ordinary file is being matched, only *match* stanzas
+without any 'TYPE' parameter are considered, while if it is a
+directory, only those with the 'TYPE' parameter specified as
+*directory* are considered. 'TYPE' can also take the value *notfound*,
+described below under 404 RESPONSES.
 
 A *match* stanza must contain at least one follow-up line specifying
 match rules. All rules must match for the stanza as a whole to match.
@@ -291,16 +295,28 @@ A HTTP 404 response is sent to the client if
  * A path element is encountered during mapping which, after URL
    unescaping, either begins with a dot or contains slashes;
  * The mapping procedure finds a file which is neither a directory nor
-   a regular file (or a symbolic link to any of the same);
+   a regular file (nor a symbolic link to any of the same);
  * An empty, non-final path element is encountered during mapping; or
  * The mapping procedure results in a file which is not matched by any
    *match* stanza.
 
-By default, *dirplex* will send a built-in 404 response, but any
-`.htrc` file or global configuration may define a request handler
-named `.notfound` to customize the behavior. Note that, unlike
-successful requests, such a handler will not be passed the
-`X-Ash-File` header.
+By default, *dirplex* will send a built-in 404 response, but there are
+two ways to customize the response:
+
+First, *match* stanzas with the type *notfound* will be matched
+against any request that would result in a 404 error. The filename for
+such matching is that of the last succesfully found component, which
+may be a directory, for example in case a name component could not be
+found in the real filesystem; or a file, for example in case a file
+was found, but not matched by any *match* stanzas.
+
+Otherwise, any request that would result in a 404 response but is
+matched by no *notfound* stanza is instead passed to a default handler
+named `.notfound`, which is handled internally in *dirplex* by
+default, but may be overridden just as any other handler may be in a
+`.htrc` file or by global configuration. Note, however, that any
+request not matched by a *notfound* stanza will not have the
+`X-Ash-File` header added to it.
 
 The built-in `.notfound` handler can also be used in *match* or
 *capture* stanzas (for example, to restrict access to certain files or