[previous] [next] [top] [search] [index]

Filters


An an arbitrary "filter" can be assigned to any file to be served. A filter is a program which reads the file and has the program output served rather than the content of the file. One common use of this feature is for on-the-fly decompression. For, example a file can be stored in its compressed form and assigned a filter like zcat which uncompresses it. Then the client is served the uncompressed file but only the compressed version is stored on disk. As another example, you might use "nroff -man" as a filter to process UNIX man files before serving. There are many other interesting uses of filters. Be creative!

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 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 infere 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.

Also notice that the Filter= directive is different from all other directives which take the value of a path to a file, in that it takes the absolute path in the UNIX file system and is not relative to the WN data hierarchy. This is done because it is likely that the maintainer will want to use filters which naturally reside outside this hierarchy.


WN -- for those who think the Web should be more than a user friendly interface to ftp

John Franks <john@math.nwu.edu>
[previous] [next] [top] [search] [index]