A filter is assigned to a file by use of the Filter= directive in the file's record in its index.cache file. For example, the lines
File=foo.gz
Content-type=text/plain
Filter=/usr/local/bin/zcat
Content-encoding=none
cause the compressed file foo.gz to be uncompressed on the fly and served to the client as a text/plain document. Notice that it is necessary to have the content-encoding line to override the default action of wndex which is to infer from the ".gz" suffix that the content-encoding is x-gzip. If the compressed file were named simply "foo" then the content-encoding line would be unnecessary.
The Filter= directive takes the value of a path to a file in three different forms. If the path begins with a '/' then it is relative to the system root. If it begins with ~/ then it is relative to the WN hierarchy root, and otherwise it is relative to the directory containing the index file.
The ability to filter files can be restricted in several ways. If WN is invoked with the -e option then no includes, filters, or CGI programs will be executed.
The -E option in conjunction with the -t or -T options restricts the use of filters to those listed in index.cache files owned by trusted users or groups. The -u option allows only the use of filters owned by the owner of the index.cache file which lists them.
If you wish to have all the standard CGI environment variables made available to the filter program you can do so by adding the line
Attributes=CGIto the file record. A list of these environment variables can be found in the Appendix D. (Also see the sample CGI script which is located in the file /docs/examples/sample.cgi which accompainies the WN distribution.)