18 September 2002

        MTCHFILE.REX: The "find best matching files" SREhttp/2 procedure.

MTCHFILE.REX is an example of a "not-found file procedure" that can be
specified using the NOT_FOUND_FILE parameter (in your possibly host-specific
SREHTTP2.CFG file).

Syntax (assuming MTCHFILE.REX is in the SREHTTP2\PROCS directory):

      not_found_file='!PROCS\MTCHFILE.REX'


MTCHFILE.REX will find several names, in the "directory" of the requested 
(but not found) file, and create a linked list to them.  However, it will 
NOT display links to directories and filenames (possibly wildcarded filenames)
listed in the DIR_EXCLUSION parameter.

Note that if a bad-directory is given, then a "best match" for the file in
a higher level directory is attempted (which might be /, the possibly
host-specific data directory).

        ------ Discussion of not-found-file procedures ------

The following arguments will be passed here (and to any other
not-found-file procedure invoked through use of not_found_file=!procname)

   docfile -- the file the selector matched (which could not be found)
   who     -- numeric client ip address
   selector-- the request selector
   verb    -- the method (it will almost always be GET)
   user    -- username (or '', if no username is available)
  verbose  -- the verbose flag
  privset  -- the client's privileges
 transaction -- the SRE2003 transaction #
 tempfile   -- a filename that can be used as a temporary file
 host_nickname -- the host_nickname

MTCHFILE.REX does not use most of these arguments, but other procedures might.

MTCHFILE.REX (and any other of this not-found-file class of procedures) must 
return a string containing a fully specified HTML document 
(complete with <HTML><HEAD> ... </BODY></HTML>.  
SREhttp/2 will then use the contents of this string as the response to 
the client.

