When the character '#' is encountered in an index file it is assumed to be the start of a comment and everything after it on that line is ignored. To include the '#' character in, for example, a document title, it must be escaped with the '\' character. I.e. when "\#" is encountered it does not signify a comment and the character '#' (without the backslash) is treated as a normal character. In fact, since all directives contain the character '=', all lines which do not contain this character are silently ignored. Also a single conceptual line of an index file can be spread over several actual lines by ending all but the last line with the '\' character. I.e. if a line ends with '\' that character is removed and the contents of the next line is considered a continuation of the current line. The maximum allowed length of a line (including continuation) is 1024 characters. The maximum allowed length of all the records corresponding to one document is 8192 characters.
The first record in an index file is special and is intended to describe attributes of the entire directory rather than individual files. It contains lines with directives specifying attributes of the directory as a whole or all the files in it. Here is a complete list of these directory directives:
Accessfile=/dir/accessfilespecifies that the file /dir/accessfile is to be used to determine access priviliges (by hostname or IP address) for this directory. If this line is omitted access is allowed for everyone. Both the path /dir/accessfile and the path ~/dir/accessfile are taken relative to the WN root directory. In particular the accessfile must be in the WN hierarchy (unlike includes or filters, for example.) If the path does not begin with a '/' or a '~' then it is relative to the directory containing the index file. (See the user's manual section: Limiting Access to Your WN Hierarchy.)
Access-denied-URL=http://host/dir/foo.htmlor the line
Access-denied-URL=/dir/foo.htmlspecifies that any request for a document in this directory which is denied because of an accessfile restriction should be redirected to the given URL. A default value for all directories can be set by uncommenting the "#define ACCESS_DENIED_URL" line in config.h and recompiling. If you use this directive be sure that the file foo.html does not have restricted access or you can create an infinite loop. This line has the special feature that it can also be placed as the first line of the accessfile controlling the directory. A line in the accessfile will override any value set in the index file.
Attributes=serveallspecifies that any file, with a few exceptions, in this directory may be served not just those listed in the index file. The server will attempt to set the content type correctly based on the file name suffix using the same default correspondences between type and suffix that wndex uses. The exceptions are that files whose name starts with '.' or ends with '~' as well as the files "index" and "index.cache" will not be served. When this directive is used in a directory protected by an accessfile or a password file be sure that these files have names that start with '.', or contain a '~'. Or better, put these files in a different directory from which nothing is served.
The line
Attributes=nosearchspecifies that the index.cache databases in the current directory and its subdirectories should not be searched when the server does a title, keyword or user defined field search. Likewise context and grep searches will not be allowed in this directory. In this case when an attempt is made to do so an error message is returned to the client. It is also possible to exclude only some files from searching with the Attributes= file directive.
For security reasons when you use an Authorization-Module you are required to use either the -t or -T option or the -a or -A optionand to have the index.cache file in the protected directory owned by the trusted user or group. This is to guard against counterfeit authorization modules.
Auth-denied-file=~/dir/foo.htmlspecifies that any request for a document in this directory which is denied because of an authorization module restriction results in the file ~/dir/foo.html being sent instead. A default value for all directories can be set by uncommenting the "#define AUTH_DENIED_FILE" line in config.h and recompiling. Note that this is not a URL but the name of a file whose content is to be sent as error text when authentication is denied. If the file name starts with '~/' as above it is assumed to be relative to the WN root directory. Otherwise it is assumed to be a path relative to the directory containing the index file.
Default-Attributes=parse,dynamicspecifies that files in this directory should be parsed and marked as dynamic documents unless they have an attributes record specifying the contrary.
Default-CGI-Handler=~/dir/handler.cgispecifies that files in this directory should all be treated as if the CGI-Handler file directive had been set to WN_Root/dir/handler.cgi. To override this setting and specify no CGI handler use the "CGI-Handler=<none>" directive.
Default-content=text/htmlspecifies that files in this directory which do not end in a suffix recognizable to wndex should be given the type "text/html". Any legitimate MIME type may be used as the value.
Default-Document=foo.htmlspecifies that a URL pointing to this directory like "http://host/dir/" will result in serving the document /WN_root/dir/foo.html instead of /WN_root/dir/index.html. Uses of this include making the default document a CGI script with "Default-Document=foo.cgi" or having a directory with HTML files all ending with the suffix ".htm" and using the directive "Default-Document=foo.htm". This directive applies only to the directory containing the index file, not to any subdirectories.
Default-Filter=/path2/filterspecifies that files in this directory should all be treated as if the Filter file directive had been set to /path2/filter. To override this setting and specify no Filter use the "Filter=<none>" directive.
Default-Includes=footer.htmlspecifies that this line should be used as the Includes= directive for any document in this directory which does not have an Includes= directive explicitly set. To override this default value simply specify an explicit Includes= directive or use Includes=
Default-List-Includes=header.html,footer.html,disclaimer.htmlspecifies that this line should be used as the List-Includes= directive for any document in this directory which does not have an Includes, Wrappers, or List-Includes directive explicitly set. To override this default value simply specify an explicit List-Includes directive or use List-Includes=
Default-Max-Age=2 weeksspecifies the Cache-Control and Expires headers of all documents served from this directory should be set to expire the document 2 weeks after it is served.
The line
Default-Max-Age=2 weeks after last-modspecifies the Cache-Control and Expires headers of all documents served from this directory should be set to expire the document 2 weeks after the last-modified date of the document. For more details see the Max-Age directive.
Default-Wrappers=wrapper.htmlspecifies that this line should be used as the Wrappers= directive for any document in this directory which does not have a Wrappers= directive explicitly set. To override this default value simply specify an explicit Wrappers= directive or use Wrappers=
If you wish the file module to have access to all the standard CGI environment variables then use the directive "Default-Attributes=cgi" with the File-Module directive
Nomatchsub=foo.htmlspecifies that the HTML file foo.html in the current directory should be used for the output of all searches (title, keyword, context, grep, etc.) on this directory which return no matches. It can only be used in conjunction with the Searchwrapper directive. If Nomatchsub is used and a Searchwrapper has not been defined an error is logged and the nomatchsub file is ignored. The file foo.html must be in the directory being searched and its name must not contain a '/'. See also Nomatchsub for files.
No-Such-File-URL=http://host/dir/foo.htmlor the line
No-Such-File-URL=/dir/foo.htmlspecifies that any request in this directory for a non-existent file or a file not listed in the index file of this directory should be redirected to the given URL. A default value for all directories and non-existent directories can be set by uncommenting the "#define NO_SUCH_FILE_URL" line in config.h and recompiling. The value set here will also be used if an index.cache file does not exist. If you use this directive be sure that the file foo.html does exist or you can create an infinite loop.
Owner=mailto:maintainer@hostThe mailto:e-mail_address may be replaced with a URL referring to the indvidual who is responsible for the documents in this directory. This information is used in an HTTP header. It is not possible to designate the owner of a single file in an index directive. However, if the file is an HTML file this can be done with a "link" tag in the header of that document.
Searchwrapper=swrap.htmlspecifies that the HTML file swrap.html in the current directory should be used as a wrapper for the output of all searches on this directory.
Subdirs=subdir1,subdir2,subdir3in the directory directives giving a comma separated list of subdirectories of the directory containing the current index file.
There are two special forms of the Subdirs directive. Using
Subdirs=<index>is equivalent having a Subdirs directive whose value is a list of all subdirectories which contain a file named "index" (or the name specified with the -i option to wndex).
Using
Subdirs=<all>is equivalent having a Subdirs directive whose value is a list of all subdirectories.
Attributes=cachablewhich will override this default. This may be necessary if you want the browser "back" button to return users to this document after they have followed a link, since otherwise the browser may not even cache the page in memory.
CGI-Handler=bar.cgicauses the script "bar.cgi" to be run and its output to be served in place of the document requested. This is a way to designate a CGI script to handle a file somewhat like a filter. The name of the script need not be in the URL since it is in the index file. So when http://host/path2/foo.html is requested this will cause the "handler", say bar.cgi, to be run with Pathinfo set to /path2/foo.html. In normal use the script bar.cgi will do something to the file foo.html and serve the output. It is useful if you want a number of files in a directory to be handled by the same CGI script. Note the file foo.html need not be used in any way by the script, but it must exist or else the server will treat it as a non-existent file.
If handler name begins with a '/' the name is considered as a path relative to the system root directory. If it begins with '~/' as in ~/dir/foo it is assumed to be relative to the WN root directory. Otherwise it is assumed to be a path relative to the directory containing the index file.
Content-encoding=x-gzipspecifies "x-gzip" as the content encoding for the file described by this record. Only two types of content encoding are supported by common browsers. They are "x-gzip" and "x-compress". They indicate that the file has been compressed with the GNU gzip utility or the UNIX compress utility. The file is then sent by the server in the compressed format and will be decompressed automatically by the browser, if it supports this functionality.
In many cases this is unnecessary to specify this explicitly as the wndex program will automatically assign the the content-encoding x-gzip to a file whose name ends with ".gz" and the content-encoding x-compress to a file whose name ends in ".Z". Supplying the value "none" for the content-encoding will prevent the server from making this automatic assignment.
Content-type=audio/basicspecifies "audio/basic" as the MIME type for the file described by this record. In many cases this is unnecessary as the wndex program will automatically assign the MIME type if the file name ends in a suffix listed in the file /lib/mime.types with a corresponding type. If this line is supplied it will override the default value of the content type determined by the suffix.
The mime.types file should be installed in a known location. The default location is in the WN src hierarchy, but this can be changed by specifying a different value when the configure script is run or by editing the value of MIME_TYPES_FILE in /config.h. The mime.types file exists so that you can add to it if you wish to add new kinds of documents to your server. The format of the file is explained in the file. A default version of the file is in /lib/mime.types. The internal defaults are the same as what is currently in this file. The mime.types file is read whenever wndex is run so wndex always knows the latest additions. This file is also read by swn (but not wn) on startup for use with directories with the serveall attribute. The swn standalone server reads this file when it is started or restarted, but only takes note of new suffixes and their mime types. You cannot change the mime type corresponding to one of the standard suffixes (as listed in the default mime.types file). To do that you need to change the server source and recompile.
Expires=Mon, 01 Sep 1997 14:11:01 GMTspecifies date and time which a document expires. Current practice is to use the format specified by RFC850 and illustrated above. In particular, GMT should be used. More information about HTTP date formats can be found here. For HTML documents the this information is automatically extracted from the document by wndex. This requires a line in the head of the HTML document like
<meta http-equiv="Expires" content="Tue, 10 Oct 1994 14:11:01 GMT">
If the Expires directive is also supplied in the index file it will override the expiration date in the document. See also the Maxage directive.
Field3=string
specifies "string" user supplied field #3 associated with the current document. These are used for field searches. The digit 3 can be replaced with any other single digit allowing a total of 10 user supplied fields.
File=foobegins a new file record for the file foo. It indicates that permission is granted for this file to be served. Other file directive lines will apply to this file until a new file record or text segment is started or the end of the index file is reached. The presence of this line causes an entry for this file to be written in the index.cache file created by wndex.
Filter=/dir/foocauses the contents of the file whose record contains this line to be used as standard input of the program foo and the output of that program to be sent to the client instead of the file itself. A common use of this is to specify a decompressing program like zcat as the filter so that a compressed version of a file can be stored on disk and then be decompressed on the fly before being sent to the client. Another example would be "Filter=/usr/bin/nroff -man" which would convert an nroff man page to an ASCII text document on the fly.
If a listed file name begins with a '/' the name is considered as a path relative to the system root directory. If it begins with '~/' as in ~/dir/foo it is assumed to be relative to the WN root directory. Otherwise it is assumed to be a path relative to the directory containing the index file.
Header=[some legal HTTP header]causes the line [some legal HTTP header] to be added to the HTTP header for this item. Don't do this unless you know what you are doing! This directive can be used multiple times to add multiple lines to the header.
Includes=file1,file2,file3causes the file whose record contains this line to be parsed for lines like <!-- #include -->. When such a marker is found one of the files listed with the Includes= directive is inserted. Subsequent occurrences of the marker cause the inclusion of subsequent files in the order in which they occur in this directive.
If a listed file name begins with a '/' the name is considered as a path relative to the system root directory. If it begins with '~/' as in ~/dir/foo it is assumed to be relative to the WN root directory. Otherwise it is assumed to be a path relative to the directory containing the index file. See the section of the user guide on includes and wrappers for more information.
Keywords=pink, elephant, HTTP
specifies a list of keywords assoicated with the current document. These are used for keyword searches. For HTML documents the keywords are automatically extracted from the document by wndex. This requires a line in the head of the HTML document like
<meta http-equiv="Keywords" content="pink, elephant, HTTP">
If the Keywords directive is also supplied in the index file it will override the keywords in the document.
List-Includes=file1,file2,file3causes the file whose record contains this line to be parsed for lines like <!-- #include "file2" -->. When such a marker is found the contents of file2 is inserted. The order of the files listed in the directive is not significant. Note that the example above grants permission for the inclusion of the three files listed. It does not require their insertion.
If a listed file name begins with a '/' the name is considered as a path relative to the system root directory. If it begins with '~/' as in ~/dir/foo it is assumed to be relative to the WN root directory. Otherwise it is assumed to be a path relative to the directory containing the index file. See the section of the user guide on includes and wrappers for more information.
Max-Age= 10 days
specifies that a Cache-Contol header should be sent to expire the document in the specified time. If no Expires header has been set elsewhere in the index file or in the file itself, if it is an HTML file, then the Expires header will also be sent with a value equal to the current time plus the time period of the Max-Age header. The time period in the Max-Age header can be specified in units of seconds, minutes, hours, days or weeks, but more than one unit (as in 2 weeks and 3 days) is not allowed.
The line
Max-Age= 10 days after last-mod
specifies that a Cache-Contol header and the Expires header (if none is set elsewhere) should be set to expire the document in the specified amount of time after the last-modified date of the document. Negative time values for the Cache-Control header will be ignored, but Expires headers with dates in the past will be used.
Nomatchsub=foo.htmlspecifies that the HTML file foo.html in the current directory should be used for the output of all searches (context, grep, etc.) on this file which return no matches. It canonly be used in conjunction with the Searchwrapper directive. See also Nomatchsub for directories.
File=foocause a request for foo to be answered with an HTTP redirect response. The client will then automatically request the new URL. The file foo need not exist.
Redirect=http://host/path/bar
The redirection always send a "301 Moved Permanently" status header followed by a "Location:" header whose value is "http://host/path/bar". This means that the value of a Redirect= directive should always be a complete URL, starting with http:// or ftp:// etc. The one excepton is that you may use "Redirect=<null>". This causes the server to send a status 204 "no response" which tells the client to do nothing and leave the display alone. The page won't be reloaded and won't change.
Refresh=60adds an HTTP header at the beginning of the transmission of this document. If the client receiving this header supports "client-pull" (currently only Netscape browsers support this) then it will automatically reload the document after 60 seconds. This is useful for documents that are updated very frequently, a stock ticker, for example. If the directive
Refresh=30; URL=http://host/path/foois used then after 30 seconds the URL http://host/path/foo is loaded. This can be used to create an automatic slide show. The Refresh header is not part of an HTTP standard and hence may evolve. If it does this directive will be subject to change!
Searchwrapper=swrap.htmlspecifies that the HTML file swrap.html in the current directory should be used as a wrapper for the output of all searches on this file.
Set-Cookie=name1=opaque1add an HTTP header at the beginning of the transmission of this document. If the client receiving this header supports cookie caching (currently only Netscape browsers support this) then it will save the name=value pairs and include them in the request headers when documents in the same directory or sub-directories are accessed. The server will put the name=value pairs in the environment variable HTTP_COOKIE for access by CGI scripts. This is useful for "shopping basket" type applications.
Set-Cookie=name=xxx; Expires=Thursday, 04-May-95 18:45:39 GMT
Normally the client will discard the cookie at the end of a session. However, if an Expires parameter like the one above is provided the cookie will be saved between sessions and only discarded when it expires.
More information about the proposed HTTP Set-Cookie header is available at http://home.netscape.com/newsref/std/cookie_spec.html
Title=This the the titlespecifies the text "This is the title" as the title of the file. If the file is an HTML document this is not necessary as wndex will attempt to read the title from the document itself. If this line is supplied anyway it will override the title in the document. If this line is not supplied and the file is not an HTML document the default title "File
Wrappers=file1causes file1 to be parsed for lines like <!-- #include -->. When such a marker is found the file whose record contains this line is inserted and the combined document is sent to the client. It is possible to list multiple files in this directive. The semantics of this are explained in the section of the user guide on server-side includes and wrappers.
If a listed file name begins with a '/' the name is considered as a path relative to the system root directory. If it begins with '~/' as in ~/dir/foo it is assumed to be relative to the WN root directory. Otherwise it is assumed to be a path relative to the directory containing the index file. See the section of the user guide on includes and wrappers for more information.