XS-HTTPD SSI's

One of the most advanced features of this WWW server is its server side includes. Server side includes (SSI's) are "commands" to the server to do something. These may be embedded in HTML documents.

The format of such a directive is as follows:
<!--#name [argument(s)]-->

name is the name of the directive. You may specify arguments to the directive if needed or wanted, seperated from the directive's name by one space. Note also that a directive must start and end on the same line. You may have other things on that line, including other directives.

When the server sends a HTML document to the remote client, it will parse all of the directives that are embedded in that document. The possible directives are:

count-total
This directive inserts the number of times that this page has ever been retrieved. You may use counters as many times as you wish per page, they will only increment once.
count-month
This directive inserts the number of times that this page has been retrieved this month.
count-today
This directive inserts the number of times that this page has been retrieved today.
count-total-gfx [location]
This directive inserts a HTML tag to include a graphical representation of the number of times that this page has ever been retrieved. If location is specified, it will be used as a base location for the font. A font has 10 digits in it, each in a seperate file, all PPM's. Say location is /~user/font1, and digit 1 is needed, then /~user/font1/1.ppm will be used as that digit.

Two default fonts are supplied with the deamon. These may be accessed with locations: /fonts/digital and /fonts/large.

count-month-gfx [location]
This directive inserts a HTML tag to include a graphical representation of the number of times that this page has been retrieved this month. See above for location.
count-today-gfx [location]
This directive inserts a HTML tag to include a graphical representation of the number of times that this page has been retrieved today. See above for location.
date
This directive inserts the current date and time, optionally in your own format. You can specify your own date and time format using the date-format directive (see below).
date-format format
This directive uses format as the new date and time format. You must specify the format in strftime(3) format. Type man strftime for help on how to use this format.
include-file file
This directive allows you to include another file in this document. Very useful for standard headers and footers. Note that included files may be nested and that directives are parsed in them. Note also that counters and such always count the original file, so you can use the count-* directives in your standard headers and footers.
last-mod [file]
This directive (with a pseudonym last-modified inserts the last modification date of either the originally request file (the current document) or the optionally specified file. The date will be in the format specified by the date-format directive.
remote-host
Inserts the name (or the IP number if the name cannot be resolved) of the remote computer that is asking for this document.
run-cgi cgi
Runs the CGI binary cgi and inserts its output at this point. Standard PATH_INFO and PATH_TRANSLATED parsing is done, so you can give argumens to the CGI binary. All standard CGI environment variables will be set up appriopriately. See the CGI section for more details on CGI's.
agent-short
This directive inserts the name of the browser that the remote user is using in the short version (i.e. without the version number). Note that Netscape is displayed as Mozilla, which is Netscape's real name.
agent-long
This directive inserts the name of the browser that the remote user is using in the long version (i.e. with version numbers and other comments that the browser sends).
if keyword pattern(s)
The following four directive are the most powerful: they allow a kind of flow control in your documents. This directive displays all text and directives after it until it encounters an endif or a else directive, if the query evaluates to true.

Possible keywords are:

browser
If any of the patterns match the browser name that the remote user if using, the query evaluates to true, otherwise it evaluates to false. See below on how to specify patterns.
remote-host
If any of the patterns match the remote host's name or IP number, the query evaluates to true, otherwise it evaluates to false.
remote-name
If any of the patterns match the remote host's name, the query evaluates to true, otherwise it evaluates to false.
remote-addr
If any of the patterns match the remote host's IP number, the query evaluates to true, otherwise it evaluates to false.
argument
It is possible (since version 2.1) to pass arguments to HTML documents. If any of the patterns match the given argument, the query evaluates to true, otherwise it evaluates to false.

Arguments are passed by appending a question mark to the page's URL and giving the arguments after that. For example:
http://www.foo.bar/~test/blah.html?this_is_an_argument

Patterns are simple wildcard patterns (case-insensitive). For example, to match any version of Netscape (which is really called Mozilla), you would use mozilla/*. If you want to match any Mosaic version 2, you would use *Mosaic*/2*.

A browser's name is always constructed in the following way:
browsername/version extra/version

if-not keyword pattern(s)
This does exactly the same as if, except that it displays the following text only if the query evaluates to false instead of true.
else
This can be used after an if or if-not directive. The meaning is obvious.
endif
Ends an if or not-if. Note that these constructions may be nested!