Novocode
Software & Networking
Previous Page Contents Next Page
 NetForge 1.0 Manual:   Filters 

Filters are used for post-processing responses of HTTP responders. A filter can read the responder's output, mofidy the response headers and write a new response body.

The name under which a Filter is installed is interpreted as a MIME type. All responses with that content type are processed by the filter.

Currently only one filter is implemented:

SSIFilter (Server-Side Includes)

The SSIFilter class implements Server-Side Includes, an easy way to include dynamic content in HTML pages. It is usually assigned to the MIME type text/x-server-parsed-html.

SSI Syntax

The SSI filter expects a document with special SGML comments which contain the SSI commands. Everything outside these comments is simply copied to the response. The SSI comments use the following syntax:


<!--#element attribute1=value1 attribute2=value2 ... -->

Note that there is a space before the end-of-comment mark "-->" but not between the beginning-of-comment mark "<!--" and the '#' sign that precedes the element name.

Attribute values

Values can be either single tokens (without spaces) or quoted strings which may contain spaces. Strings are quoted with double quote characters ('"'). A literal quote character can be embedded in a quoted string by escaping it with a backslash. All SSI variables (see below) can be used in values by preceding them with a dollar sign. A literal dollar sign can be inserted by preceding it with a backslash. To avoid ambiguities, variable names can be enclosed in braces.

Example. The following command sets the variable FOO to the value $BAR = "BARVALUE" if the variable BAR has the value BARVALUE:


<!--#set var=FOO value="\$BAR = \"${BAR}\"" -->

Variables

In addition to the standard CGI variables, the following variables are predefined:

 DATE_GMT  The current time in Greenwich Mean Time.
 DATE_LOCAL  The current time in the server's local time zone.
 DOCUMENT_NAME  The name of the resource that was requested by the client, without path (i.e. the URL-decoded part of the Request-URI between the last slash and an eventual option part).
 DOCUMENT_PATH  The URL-decoded Request-URI (without an eventual option part).
 LAST_MODIFIED  The last modification date of the requested resource if available, otherwise undefined.

Evaluating or printing an undefined variable results in the string "(none)". See below for descriptions of the SSI commands set, echo and printenv which deal with variables.

Commands

The following SSI commands (elements) are implemented. Commands and attributes which are specific to NetForge's SSI implementation are marked as "NetForge only".


Last modified Feb/17/1999 by Stefan Zeiger