This module makes it possible to expand "macros" embedded in
HTML pages before they are delivered to the client, that is
Server-Side Includes (SSI). To make this possible the server
parses HTML pages on-the-fly and optionally includes the current
date, the requested file's last modification date or the size
(or last modification date) of other files. In its more advanced
form, it can include output from embedded CGI and /bin/sh
scripts.
Having the server parse HTML pages is a double edged sword! It can be costly for a heavily loaded server to perform parsing of HTML pages while sending them. Furthermore, it can be considered a security risk to have average users executing commands in the name of the Erlang node user. Carefully consider these items before activating server-side includes. |
The server must be told which filename extensions to be used
for the parsed files. These files, while very similar to HTML,
are not HTML and are thus not treated the same. Internally, the
server uses the magic MIME type text/x-server-parsed-html
to identify parsed documents. It will then perform a format
conversion to change these files into HTML for the
client. Update the mime.types
file, as described in the
Mime Type Settings section
of httpd(3)
, to tell the server which extension to use
for parsed files, for example:
text/x-server-parsed-html shtml shtm
This makes files ending with .shtml
and .shtm
into parsed files. Alternatively, if the performance hit is not a
problem, all HTML pages can be marked as parsed:
text/x-server-parsed-html html htm
All server-side include directives to the server are formatted as SGML comments within the HTML page. This is in case the document should ever find itself in the client's hands unparsed. Each directive has the following format:
<!--#command tag1="value1" tag2="value2" -->
Each command takes different arguments, most only accept one tag at a time. Here is a breakdown of the commands and their associated tags:
config
errmsg
sizefmt
bytes
or
abbrev
. bytes
for a formatted byte count
or abbrev
for an abbreviated version displaying
the number of kilobytes.
include
virtual
file
../
cannot be used in this pathname, nor
can absolute paths. As above, you can send other parsed
documents, but you cannot send CGI scripts.
echo
var
, whose value is the name of the variable you wish
to echo.
fsize
include
command. The resulting
format of this command is subject to the sizefmt
parameter to the config
command.
flastmod
include
command.
exec
cmd
/bin/sh
. All
of the variables defined below are defined, and can be
used in the command.
cgi
A number of variables are made available to parsed documents. In addition to the CGI variable set, the following variables are made available:
DOCUMENT_NAME
DOCUMENT_URI
/docs/tutorials/foo.shtml
).
QUERY_STRING_UNESCAPED
\
.
DATE_LOCAL
DATE_GMT
LAST_MODIFIED
Uses the following EWSAPI interaction data, if available:
{real_name,{Path,AfterPath}}
{remote_user,RemoteUser}
Exports the following EWSAPI interaction data, if possible:
{mime_type,MimeType}
MimeType
as defined in the
Mime Type Settings
section of httpd_core(3)
.
Uses the following EWSAPI functions: