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

WN Auxiliary Modules


Future versions of WN will provide some features by auxiliary modules. These are separate C programs called by the server to provide some function like authorization (authentication) or indexed searches or database access. The first non-beta release of WN will have a module for authorization using the "basic" scheme supported by most clients and will have a module to do index searches. The current version has the support infra-structure or "hooks"for several services which maintainers may wish to create.

Database Modules

The index.cache in each directory is in fact a small flat database of characteristics of that directory and the files contained in it. This can be replaced on a per directory basis by a user supplied module to provide the same information. In the index file for such a directory you should create a Directory Record entry like
     Cache-Module=/full/path/to/foo

The program foo should be an interface to your database. It is permissable to follow "foo" in this line with any desired arguments to be passed to it. The program foo should read the environment variable WN_KEY which will contain everything after the final '/' in the URL being served. Based on this key it should return a single line in the format of an index.cache file. The format of this file is documented in docs/cacheformat.

File Modules

It is perhaps more useful to have the files being returned reside in a database. This can be the database used for the Cache-Module or a different one. To use such a database interface called "bar", in the index file for its directory you should create a Directory Record entry like
     File-Module=/full/path/to/bar

The program bar should be an interface to your database. It should read the environment variable WN_KEY which will contain everything after the final '/' in the URL being served. Based on this key it should return a document to be served (perhaps after processing with wrappers or includes). When a file module is used it is also necessary to either use a Cache-module or have an actual index.cache file with the name of all documents which might be returned by the database.

Authorization Modules

All authorization requests in wn are handled by an authorization module. The beta release does not contain such a module but users are invited to provide their own. Information is placed in environment variables as with CGI. In particular the environment variable HTTP_AUTHORIZATION will contain the contents of the Authorization header supplied by the client. WN will automatically handle the request for this header. The server expects the first character of the return from this module to be 't' if authorization is granted and something else if it is denied. This has only been lightly tested. To use this feature the index file of each directory requiring authorization should contain lines like
     Authorization-realm=myrealm
     Authorization-module=/full/path/to/authmod
     Authorization-type=basic

The program authmod should indicate the granting or denial of authorization by its return value described above. The Authorization realm is a designation which is sent to the client with the authorization request allowing the clie to decide whether the user has already supplied a password which can be reused (if the realm is the as when the password was supplied) or if a new password needs to be entered.

Index Search Modules

Indexed searches (e.g. glimpse or WAIS will be be supported in WN by auxiliary modules. No such modules yet exist, but maintainers may wish to create them. To use such a module you should have a form action be something like http://host/dir/search=index. Then in the index file in the directory dir you should have a line like
     Search-Module=/full/path/to/searchmod

The program searchmod should read the environment variable QUERY_STRING and return a partial HTML document. The typical case would be the program returns an unordered list of anchors to documents containing a match to the query string. This list can be wrapped by including a Searchwrapper directory record. If it is not a default wrapper with text like "Here are the matches for your search" is supplied.


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]