SSI.cgi 1.8

A standalone SSI (Server Side Includes) interpreter
SSI.cgi is a standalone SSI (Server Side Includes) interpreter, intended for use with lightweight webservers (such as Cherokee) that themselves do not support SSI. SSI.cgi script is implemented using C, with the intention of minimizing both overheads and dependency requirements.

The project started when I was considering possible alternatives to Apache, the webserver I have used in the past for both my own websites and those I have setup for other people. I came across Cherokee, which seemed to offer a good balance between being lightweight (in particular, ease of setup) and features that are useful. In particular its ability to run scripts under different Unix users didn't require the awkward setting up that suexec and suPHP needed.

The big problem is that my more recent sites used SSI to avoid duplicating common page components such as headers. Although one possibility was to convert the sites to use PHP instead, this was not something I wanted to do. I also didn't want to use Perl, which was required by the SSI parsers I came across on the web. In the end I decided to write my own parser, and SSI.cgi was the result.

Supported directives

include - Include a file

file

Included file is relative to the filesystem directory of current file.

docroot

Included file is relative to the document root on the filesystem. Some SSI documents state this is the behaviour of the virtual parameter.

virtual

Included file is relative to URL of the document. This will trigger a fetch request to the server, so the included files will need to be HTTP-accessible, at least for requests originating from the system hosting SSI.cgi. This approach is required as SSI.cgi is unaware of URL-to-filesystem mappings that may be in force on the server.

echo - Display a parameter (or enviornment variable)

var

Name of variable to print. Multiple var parameters may be included

encoding

Encoding to use when printing variable. The encoding affects all var= parameter between itself and either the next encoding parameter or the end of the echo command. Valid choices are none, url (encode for use in links), and entity (encode using HTML escape codes). Default is entity encoding.

flastmod - Display datestamp of file

file

docroot

virtual

fsize - Display file size

file

docroot

virtual

printenv - Print all enviornment (if enabled) and user variables.

set - Set user variable

var

Name of variable to set

value

What to set the variable to

config - Set SSI configuration options

sizefmt - Format for displaying file sizes with fsize

Choice of bytes (default) which prints the exact size in bytes, and abbrev which postfixes the numbers with K, M or G if the files are in the kilobyte/megabyte/gigabyte region.

errmsg - SSI error message

Default is There was an error processing this directive

timefmt - Format for flastmod timestamps

Uses strftime for time formatting. Default is %d/%m/%Y %H:%M%:%.

echomsg - Placeholder for undefined variables

Shown when echo is used with a nonexistant variable. Defaault is undefined

if - Conditional statement

expr

Conditional expression. It follow

elif - Conditional statement (else if)

expr

Conditional expression

else - Conditional statement

endif - Conditional statement

Requirements:

- cURL - Required to support the virtual parameter.
- POSIX Threads - Required for FastCGI

last updated on:
July 26th, 2009, 19:42 GMT
price:
FREE!
homepage:
ssicgi.remynet.org
license type:
GPL (GNU General Public License) 
developed by:
Remy Horton
category:
ROOT \ Internet \ HTTP (WWW)
SSI.cgi
Download Button

In a hurry? Add it to your Download Basket!

user rating 14

3.4/5
 

0/5

Rate it!

Add your review!

SUBMIT