AccessByFile
Action
BasicAuth
BasicProxy
CGI
CheckForDirectory
ConditionalGet
DeleteTemporaryFiles
DirectoryExists
DirectoryIndex
ExpressionLogger
FlexibleHandler
MIMETypeByExtension
MapToErrorDocument
PathMapper
ReadRequestHeaders
RefuseFileByMask
ReturnCode
SendErrorMessage
SendFile
SendPi3Expression
SendSSI
StatusCode
VirtualHost
VirtualHostByAddress
VirtualHostByName
VirtualHostByURL


Name:
AccessByFile

Description:
Verify permissions associated with the resource identified by the current physical path.

Options:

Overview
Option Default Values Short Description Example(s)
RequirePermissions - Combination of 'x', 'r', 'w' Permissions required on file RequirePermissions="x"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

RequirePermissions
These permissions will be compared against the permissions on the filesystem resource to determine if this handler will indicate a match by returning PIAPI_COMPLETED without setting the status code to 403. This value is obtained by concatenating any of the following flags together.
Option Meaning
r Resource must be readable
w Resource must be writable
x Resource must be executable
Permission flags are not case sensitive.

Phase:
CHECKACCESS

Returns:
PIAPI_ERROR if this handler was invoked for an inappropriate phase, otherwise PIAPI_COMPLETED is returned. If the resource does not have the required permissions this handler sets the response status to 403 Forbidden.

Note:
Not all permission flags may be checked on all operating systems, where a permission cannot be verified because the operating system does not support the flag that permission will be considered passed. An observation of this note is that a later phase may fail to access a resource that passed this verification for the access attempted.

Example:

	<Object>
		Name AccessByFile
		Class AccessByFileClass
	</Object>

	<Object>
		...
		CheckAccess AccessByFile RequirePermissions="R"
		...
	</Object>

	

:


Name:
Action

Description:
Evaluate a Pi3Expression to cause a side effect.

Options:

Overview
Option Default Values Short Description Example(s)
Pi3Expression + A Pi3Expression Pi3Expression to evaulate Pi3Expression="&dbreplace(response,string,ObjectMap,Scripts)"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

Pi3Expression
Specifies the Pi3Expression that will be evaulated.

Phase:
Any

Returns:
PIAPI_ERROR if this handler was invoked for an inappropriate phase, otherwise PIAPI_CONTINUE is returned.

Example:

	<Object>
		Name Action
		Class ActionClass
	</Object>

	<Object>
		...
		CheckType Action Pi3Expression="&dbreplace(response,rfc822,\
			Content-Type,text/plain)"
		...
	</Object>

	

:


Name:
BasicAuth

Description:
Basic authentication is not included in this distribution.

Options:

Overview
Option Default Values Short Description Example(s)
Realm + A string Realm to authenticate Realm="Admin"
Base64 + A base64 encoded string Encoding of username and password Base64="a9Dedd034"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

Base64
Specify a base64 encoded pattern of username and password to be matched against browser username and passwords. This directive can be repeated multiple times to specify multiple valid username and passwords.
Realm
Realm to be authenticated by this handler.

Phase:
CHECKAUTH

Returns:
PIAPI_COMPLETED if authentication passed. INT_REDIRECT if the status was set to 401 to challenge, PIAPI_CONTINUE if this handler choose to take no action and PIAPI_ERROR if this handler was invoked for a phase other than CHECKAUTH.

Note:

Example:

	<Object>
		Name BasicAuth
		Class BasicAuthClass
	</Object>

	<Object>
		...
		Handle BasicAuth 
		...
	</Object>
	

:


Name:
BasicProxy

Description:
Perform simple proxy requests. This handler allows some filtering of forward client headers, but no caching. Proxy requests use HTTP/1.0

Options:

Overview
Option Default Values Short Description Example(s)
IOObject - <A Pi3 Object> Prototype IO object for proxy forwarding IOObject "TCPIPClient"
CacheRoot - <directory path> Relative or Absolute path to cache root CacheRoot "Cache"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

IOObject
Specifies the protocol IO object used to connect to remote HTTP servers. This object can be a protocol IO implementor (such as TCP/IP or named pipes) or an IO filter which manipulates the data en route to the server.
CacheRoot
Specifies the path to the directory where cached data will be kept for proxy caching. If this value is not specified proxy caching is disabled.

Phase:
HANDLE

Returns:
PIAPI_COMPLETED on success. If this handler was invoked for a phase other than HANDLE then PIAPI_ERROR is returned.

Note:

Example:

	<Object>
		Name BasicProxy
		Class BasicProxyClass
	</Object>

	<Object>
		...
		Handle BasicProxy
		...
	</Object>

	

:


Name:
CGI

Description:
This HTTP Handler handles CGI requests. This documentation is not completed. Please refer to source file and/or example configuration files for typical usage.

Options:

Overview
Option Default Values Short Description Example(s)
FileIOObject + <objectname> A Pi3 IO object FileIOObject "CGIFileIO"
Variable - <Pi3Expression> A variable definition Variable "GATEWAY_INTERFACE=CGI/1.1"
DataFile - <Pi3Expression> Path to CGI data file DataFile "./CGITemp/%u.ini"
StdinFile - <Pi3Expression> Path to CGI input file StdinFile "./CGITemp/%u.in"
StdoutFile - <Pi3Expression> Path to CGI output file StdoutFile "./CGITemp/%u.out"
DataBlock - <Pi3Expression> Block of text written to datafile DataBlock "[CGI]\nRequest Protocol..."
KillAfter -1 <A number> Time to wait before killing the process. KillAfter "-1"
Flag - "16-Bit", etc. A flag to effect CGI Flag "16-Bit"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

FileIOObject
Specifies the IO object to be used to communicate with CGI programs. A prototype object is created on initialization and a copy is generated using PIObject_copy() for each CGI program.
Variable
Specifies an environment variable expression to be set into the environment block of CGI programs.
DataFile
A Pi3Expression which is evaluated to form the full path to a file used to pass variable-value arguments to the CGI program.

This mechanism is typically used to support CGI variants other than standard CGI, namely WinCGI and DOSCGI.

Specification of 'DataFile', 'StdinFile' or 'StdoutFile' cause the standard CGI streams environment to be disabled.

StdinFile
A Pi3Expression which is evaluated to form the full path to a file used to pass input from the browser to the CGI program.

This mechanism is typically used to support CGI variants other than standard CGI, namely WinCGI and DOSCGI.

Specification of 'DataFile', 'StdinFile' or 'StdoutFile' cause the standard CGI streams environment to be disabled.

StdoutFile
A Pi3Expression which is evaluated to form the full path to a file used to pass the standard output from the CGI program. Some forms of CGI, notably WinCGI use files to pass information between the CGI program and HTTP server. The parameter %u used in the expression will evaluate to a sequence of numbers and letters unique to this HTTP process and request.

This mechanism is typically used to support CGI variants other than standard CGI, namely WinCGI and DOSCGI.

Specification of 'DataFile', 'StdinFile' or 'StdoutFile' cause the standard CGI streams environment to be disabled.

DataBlock
A Pi3Expression which is evaluated to form the contents of the data file (.INI file) passed to the CGI program.

This mechanism is typically used to support CGI variants other than standard CGI, namely WinCGI and DOSCGI.

KillAfter
Specifies the amount of time the server will wait for a CGI response before forceably killing the process. -1 specifies an infinite timeout. This value is measured in seconds.
Flag
Specifies a flag which changes CGI behaviour. This directive can be repeated multiple times to add different flags.

Flags are:-
16-Bit Windows NT onlyExpect CGI programs to be 16-Bit Windows or MS-DOS images, change semantics appropriately.

Example:

	<Object>
		Name CGI
		Class CGIClass
		FileIOObject "CGIFileIO"
		Variable "GATEWAY_INTERFACE=CGI/1.1"
	</Object>

	<Object>
		Name CGI
		Class CGIClass
		FileIOObject "CGIFileIO"
		Variable "GATEWAY_INTERFACE=WinCGI/1.0"
		CGITempDir "CGITemp"
		DataFile "./CGITemp/%u.dat"
		StdinFile "./CGITemp/%u.in"
		StdoutFile "./CGITemp/%u.out"
		DataBlock "[CGI]\nRequest Protocol=HTTP/1.0\n"
	</Object>
	

:


Name:
CheckForDirectory

Description:
Check if the resources identified by the physical path is a directory. If the resource is a directory then set the Content-Type of the resource to the type identified by the 'SetType' parameter.

Options:

Overview
Option Default Values Short Description Example(s)
SetType + A MIME type/subtype pair Internal directory MIME type SetType="internal/x-directory"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

SetType
The internal MIME type used to identify directory resources. Typically this will be "internal/x-directory".

Phase:
CHECKTYPE

Returns:
PIAPI_COMPLETED if the resource was a directory and the Content-Type was set to the type specified by the 'SetType' parameter.

Example:

	<Object>
		Name CheckForDirectory
		Class CheckForDirectoryClass
	</Object>

	<Object>
		...
		CheckType CheckForDirectory SetType="internal/x-directory"
		...
	</Object>

	

:


Name:
ConditionalGet

Description:
Set the HTTP response status code to '304 Not Modified' if all the

following criteria are met:

Options:

Overview
Option Default Values Short Description Example(s)
Flag - RefreshOlderThanServer Force refresh on server start Flag="RefreshOlderThanServer"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

Flag
Specify a flag which effects the behaviour of this handler.

RefreshOlderThanServer forces the handler not to return 304 (not modified) status for a file modified before the server was last restarted (this handler was loaded).

Phase:
Any phase, usually CHECKPATH.

Returns:
PIAPI_COMPLETED if the status was set to '304 Not Modified', otherwise PIAPI_CONTINUE.

Example:

	<Object>
		Name ConditionalGet
		Class ConditionalGetClass
	</Object>

	<Object>
		...
		CheckType ConditionalGet
		...
	</Object>

	

:


Name:
DeleteTemporaryFiles

Description:
Deletes temporary files from a response cycle. Temporary files are listed in the "TemporaryFile", string variable of the response DB.

If debugging is enabled this handler will not delete any files.

Phase:
DESTROY

Returns:
PIAPI_CONTINUE, or PIAPI_ERROR if invoked for a phase other than DESTROY.

Note:

Example:

	<Object>
		Name DeleteTemporaryFiles
		Class DeleteTemporaryFilesClass
	</Object>

	<Object>
		...
		Destroy DeleteTemporaryFiles
		...
	</Object>

	

:


Name:
DirectoryExists

Description:

Executes the following steps:

Options:

Overview
Option Default Values Short Description Example(s)
IndexFile - Filename Index file name IndexFile="index.html"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

IndexFile
Specify the name of a directory index file to be sent to the client instead of an automatically generated index. This parameter can be repeated multiple time to specify alternate indexfiles. Indexfiles are used in the order they are specified.

Phase:
CHECKPATH

Returns:
PIAPI_COMPLETED if the phase completed succesfully. PIAPI_CONTINUE if no action was taken, this will occur when the specified resource is not a directory. PIAPI_ERROR and PIAPI_ABORT respectively when generic and severe errors occur.

Example:

	<Object>
		Name DirectoryExists
		Class DirectoryExistsClass
	</Object>

	<Object>
		...
		CheckPath DirectoryExists IndexFile="index.html" \
			IndexFile="default.html"
		...
	</Object>

	

:


Name:
DirectoryIndex

Description:
Generate directory indexes based on flexible criteria and send the output directly to the remote client. The directory listing sent to the user is composed of the following

document in order:
An optional header, specified by 'HeaderPattern'. An optional header file from the directory, specified by 'HeaderFile'. An optional list start pattern, specified by 'ListTop'. Every applicable file in the directory, output format is specified by 'FilePattern'. An optional list end pattern, specified by 'ListBottom'. An optional footer file, specified by 'FooterFile'. An optional footer pattern, specified by 'FooterPattern'.

Options:

Overview
Option Default Values Short Description Example(s)
HeaderPattern - A Pi3Expression Output first HeaderPattern="Index of %p"
HeaderFile - A filename File sent before listing HeaderFile="HEADER"
FooterFile - A filename File send after listing FooterFile="FOOTER"
ListTop - A Pi3Expression Output before file iteration ListTop="

Directory listing of %p

"
FilePattern + A Pi3Expression Determines output generated for every file FilePattern="&abbrev(%n,32,...)&align(%s,10,right)"
ListBottom - A Pi3Expression Output after file iteration ListBottom="
"
FooterPattern - A Pi3Expression Output last FooterPattern=""
DescriptionFile - <filename> File with descriptions of files DescriptionFile=".desc"
MIMEIcon - "MIME icon_relative_path" Maps a MIME specification to an icons path MIMEIcon="text/* /icons/text.gif"; MIMEIcon="* /icons/unknown.gif"
Include - Regular expression A file pattern to include Include="*"
Exclude - Regular expression A file pattern to exclude Exclude="."
HTTPEquiv - <rfc822-variable>: <content> An rfc822 response header to send HTTPEquiv="Content-Type: text/plain"
LastModifiedFormat - "%a %b %d %Y %T GMT" Format for file last modified date LastModifedFormat="%a %b %d %Y %T GMT"
SwapFileName - "file1 file2" Replace any file1 name with file2 SwapFileName=".. Parent Directory"
Options - Options flags as described below Options which effect behaviour Options "Name | AltName | Size etc."
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

HeaderPattern
Specifies the pattern that will be output first. See the directive 'FilePattern' for a description of parameters.
FooterPattern
Specifies the pattern that will be output last. See the directive 'FilePattern' for a description of parameters.
HeaderFile
Specifies the name of a file that will be sent before the directory listing and ListTop pattern but after the HeaderPattern pattern. Typically this file would also be excluded from the directory list by naming it in an 'Exclude' directive.
FooterFile
Specified the name of a file that will be sent after the directory index and ListBottom pattern, but before the FooterPattern pattern. Typically this file would also be excluded from the directory listing by naming it in an 'Exclude' directive.
ListTop
Determines the output generated before iterating through files. See 'FilePattern' for a description of parameters.
FilePattern
Determines the output generated for every file which meets the criteria specified by 'Include' and 'Exclude'. This is a Pi3Expression with

the following parameters specific to directory indexing:

Pi3Expression parameter Evaluates to
%aAlternate file name
%bEmpty if file is not a directory
%cMedia (MIME) type
%dDescription of the file if available
%lFile last modified date
%nFile/directory name
%iIcon
%pDirectory (virtual path)
%rRelative path
%sSize in decimal
ListBottom
Determines the output generated after iterating through files. See 'FilePattern' for a description of parameters.
MIMEIcon
Specify a mapping from a MIME type to an icons relative path. The MIME type is considered the first part of the specified string up the the first whitespace. The MIME pattern is a simple regular expression which matches wildcards (*). This directive can be repeated multiple times to denote different MIME mappings. Typically the pattern '*' would be mapped to a default icon.
DescriptionFile
Specifies a file with descriptions of other files. Each line in the

file is of the form:

	filename|its description
Whitespace will not be stripped out of the filename or description. Typically this file would also be excluded from the directory list by naming it in an 'Exclude' directive. If present a files description can be accessed via parameter %d.
Include
Specifies the file patterns which will included in the directory listing. The pattern is a simple regular expression (allows wildcards (*)). The directory indexer first allows file then excludes a subset of them with the 'Exclude' directive. The include directive may be repeated multiple times.
Exclude
Specifies the file patterns which will exclude from the directory listing. The pattern is a simple regular expression (allows wildcards (*)). The directory indexer first allows files using 'Include' patterns then excludes a subset of them. The exclude directive may be repeated multiple times.
LastModifiedFormat
Specifies the format (according to the C library strftime() function) for the last modified date of the file. The directive enables parameter %l to contain this format.
HTTPEquiv
Specifies an HTTP header to be sent to the remote client as part of the response. This directive may be used to override the default response media of 'text/html'. This pattern may be repeated multiple times.
SwapFileName
If the current file matches the specified filename the replacement filename will be subtituted. SwapFileName takes a string as argument, the pattern up to the first whitespace character is considered the 'old' filename, subsequent characters, excluding leading whitespace are considered the 'new' filename.
Options
Specifies options which effect the behaviour of directory indexing, many available facilities are optional for performance reasons, the table below lists the available option flags with thier meanings.
Option Meaning
Name Lookup the name of the file or directory and put it in parameter %n
AltName Lookup the alternate name of the file or directory and put it in parameter %a.
Icon Evaluate the appropriate icon file for the file based on its extension and MIME type and make it available through parameter %i
Size Record the filesize of the current file in parameter %s in full decimal. If the current file is a directory '-' is placed in %s. If more than one of 'Size', 'AbbrevSize' or 'FormatSize' are used the results are undefined.
MIMEType Record the MIME type of the current file in parameter %c.
RelPath Record the relative path (path component of URL) to the file in parameter %r.
AbbrevSize The filesize is abbreviated and placed in parameter %s. The abbreviated file size has the following form '<1K', '3M', '2K', etc. If more than one of 'Size', 'AbbrevSize' or 'FormatSize' are used the results are undefined.
FormatSize The filesize is formatted with the comma (',') character seperating thousands. The formatted size of place in parameter $s. If more than one of 'Size', 'AbbrevSize' or 'FormatSize' are used the results are undefined.
Multiple options may be listed together by seperating them using the pipe ('|') character. Whitespace will be stripped from the option pattern. Options are matched without regard to case sensitivity. Unknown options will raise a configuration error. The option directive may be repeated multiple times.

Phase:
HANDLE

Returns:
PIAPI_COMPLETED if a directory index was succesfully sent to the client. PIAPI_CONTINUE if this handler done nothing. PIAPI_ERROR and PIAPI_ABORT on generic and severe error conditions.

Example:

	<Object>
		Name DirectoryIndex
		Class DirectoryIndexClass
		Options "Name | Size | MIMEType"
	</Object>

	<Object>
		...
		Handle DirectoryIndex 
		...
	</Object>
	

:


Name:
ExpressionLogger

Description:
Writes a logfile with flexible data and format.

Options:

Overview
Option Default Values Short Description Example(s)
File + <filepath> Relative or Absolute path to log file File="Logs/access.txt"
Expression + <Pi3Expression> Pi3Expression to write Expression="$A $h - [$t] $r $s $b"
OpenMode w w or a File mode to open logfile with OpenMode="a"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

File
Relative or absolute path to logfile.
Expression
Pi3Expression to write to logfile every time this handler is invoked
OpenMode
Specifies the way the log file will be opened. 'A' is append, the file is opened so as to appended to existing data. 'W' the file is truncated on open if it already exists. In both cases the file is created if it does not already exist.

Phase:
LOG

Returns:
PIAPI_ERROR if this handler was invoked for a phase other than LOG. Otherwise PIAPI_CONTINUE;

Example:

	<Object>
		Name ExpressionLogger
		Class ExpressionLoggerClass
		OpenMode "a"
		Expression "$A $h - [$t] $r $s $b"
	</Object>

	<Object>
		...
		Log ExpressionLogger File="Logs/access.txt"
		...
	</Object>

	
-->

:


Name:
FlexibleHandler

Description:
Dispatches requests to multiple handlers depending on the request phase.

Options:

Overview
Option Default Values Short Description Example(s)
Condition - A Pi3Expression Makes handler conditional Condition="&cmp(dblookup(response,string,ObjectMap),Scripts)"
Handlers - An optional condition followed by a list of handler names Handles invoked for all phases Handlers "yes" "Errors Scripts Default"
<phase> - A phase name followed by an optional condition and a handler Define a handler for a phase Destroy "¬($d)" DeleteTemporaryFiles
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

Condition
A Pi3Expression which must evaluate to true before any of the specified handlers are invoked to handle the request. This directive can be repeat multiple times to specify multiple conditions which must all evaluate to true before the any handlers are invoked.
Handlers
An optional statement of the form 'Condition=<Pi3Expression>' followed by a list of handler objects. The list of handler objects may be optionally quoted. These handlers are invoked for all phases of request processing.
<phase>
An optional statement of the form 'Condition=<Pi3Expression>' followed by a handler name and parameters.

Phase:
All

Returns:
PIAPI_COMPLETED if the request from processed, PIAPI_CONTINUE otherwise. PIAPI_ERROR or PIAPI_ABORT if any sub-handler returned these error codes.

Example:

	<Object>
		Name FlexibleHandler
		Class FlexibleHandlerClass
		Condition "&cmp(dblookup(response,string,ObjectMap),Scripts)"
		Handlers Condition="<expr>" "Errors Scripts Default"
		Init ...
		Headers ...
		HostMap ...
		Mapping ...
		CheckPath ...
		CheckAccess ...
		CheckType ...
		Handle ...
		Handle Condition="<expr>" ...
		Handle ...
		Log Condition="<expr>" ...
		Destroy Condition="<expr>" ...
	</Object>

	<Object>
		...
		Handle FlexibleHandler 
		...
	</Object>

	

:


Name:
MIMETypeByExtension

Description:
Set the MIME Type of the resource identified by the current physical path by using the function HTTPCore_getMIMETypeFromExtension().

This looks up the MIME type using the file extension component of the physical path in the list of MIME types loaded into the server.

Phase:
CHECKTYPE

Returns:
PIAPI_CONTINUE in all cases.

Example:

	<Object>
		Name MIMETypeByExtension
		Class MIMETypeByExtensionClass
	</Object>

	<Object>
		...
		CheckType MIMETypeByExtension
		...
	</Object>
	

:


Name:
MapToErrorDocument

Description:
This handler sets an error document virtual path according to the HTTP error status code. Subsequent mapping handlers map this virtual path to a physical path. If a virtual path is mapped a number of the original client RFC822 request headers are modified or removed, most notably, the Method is set to 'GET' and any 'If-Modified-Since' headers are removed. This avoids confusion where subsequent handlers interpret the error resource in the context of meta information of the original resource.

Options:

Overview
Option Default Values Short Description Example(s)
IgnoreStatus - 0, 200, etc. HTTP response codes IgnoreStatus="0 200"
<nnn> - /errors/404.html, /msgs/403.shtml, etc. Response specific virtual error paths 404="/errors/404.html"; 403="/errors/403.shtml"
DefaultMessage + /errors/Unknown.html, /msgs/unknown.shtml, etc. Default error message virtual path DefaultMessage="/errors/Unknown.html"
Action - A Pi3Expression Evaluated if the error code is mapped Action="&dbreplace(response,sting,ObjectMap,...)"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

IgnoreStatus
HTTP response codes which should not be considered errors. This field takes the form of a sequence of 3 digit decimal codes seperated by spaces. NOTE: Typically the values 0 and 200 will always be included.
<nnn>
This directive is used to specify the error message virtual path to be set for a specific status code.
DefaultMessage
The default error message. This is used for status codes which have not been specified as ignorable, but which have no error virtual path explicitly defined.
Action
A Pi3Expression that will be evaulated if the error status code is mapped.

Phase:
MAPPING

Returns:
PIAPI_CONTINUE in all non-error cases, whether or not an error virtual path was set. PIAPI_ERROR and PIAPI_ABORT respectively for generic and severe error conditions.

Example:

	<Object>
		Name MapToErrorDocument
		Class MapToErrorDocumentClass
		IgnoreStatus "0 200"
	</Object>

	<Object>
		...
		Handle MapToErrorDocument DefaultMessage="/errors/Unknown.html" 403="/errors/Forbidden.html"
		...
	</Object>

	

:


Name:
PathMapper

Description:
Maps a virtual path to another virtual path or a physical path.

Options:

Overview
Option Default Values Short Description Example(s)
From + <path> Search path From="/"
To + <path> Replace path To="/home/WWWDocs/"
CaseSensitive Yes Yes|No Specifies case sensitivity of "From" matching CaseSensitive="No"
PathInfo No Yes|No Specifies if path after "To" is PATH_INFO PathInfo="Yes"
Action - A Pi3 Expression Expression to be evaluated if path is mapped Action="&dbreplace(response,string,ObjectMap,Scripts)"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

From
Specifies the virtual path to be replaced. The first and last characters of this virtual path must be '/'.
To
Specifies the path to replace the entire virtual path.
CaseSensitive
Specifies whether or not matching the "From" pattern to the virtual path will be case sensitive or not.
PathInfo
Specifies whether or not the pattern which follows the "From" section of the virtual path will be appended to the "To" path or placed in the PATH_INFO variable.

Typically CGI mapping sets PATH_INFO whereas regular document mapping does not.

Action
Specifies a Pi3 expression which will be evaluated if the path is mapped by this handler. This allows a 'marker' to be set to effect the processing of later phases. This directive may be specified multiple times for multiple different actions.

Phase:
MAPPING

Returns:
PIAPI_ERROR if this handler was invoked for an inappropriate phase, otherwise, PIAPI_COMPLETED if a path was mapped and PIAPI_CONTINUE if no path was mapped.

Note:
The 'From' pattern must begin and end with '/' character, otherwise an initialization error will be raised. This is to ensure that path mapping does not result in unintended files becoming visible.

Note that paths are mapped in the order listed in the configuration file, so a path mapping statement with From="/" would match before one with From="/icons/" is listed first. Path mapping should be list in reverse order of directory depth to ensure correct mapping (place mapper with From="/" AFTER the one with From="/icons/").

Example:

	<Object>
		Name PathMapper
		Class PathMapperClass
	</Object>

	<Object>
		...
		CheckAccess PathMapper From="/" To="/home/Pi3Web/WebRoot/"
		...
	</Object>

	

:


Name:
ReadRequestHeaders

Description:
Read the status line and client request headers for a new HTTP client request. On read a correct request this handler may disable connection keep open for the request if it is enable and any of the following conditions are

met:

Phase:
HEADERS

Returns:
PIAPI_COMPLETED if the phase completed without serious error. An HTTP error status response (such as '400 Bad Request') may have been set. On error PIAPI_ERROR is returned. An example of an error would be invoking this handler for a phase other that 'HEADERS'.

Example:

	<Object>
		Name ReadRequestHeaders
		Class ReadRequestHeadersClass
	</Object>

	<Object>
		...
		Headers ReadRequestHeaders
		...
	</Object>

	

:


Name:
RefuseFileByMask

Description:
Set an HTTP error response code if the physical resource does not match particular criteria.

Options:

Overview
Option Default Values Short Description Example(s)
RefuseStatus - HTTP Response code Response code to set on failure RefuseStatus=404; RefuseStatus="403"
AllowFileMask - Combination of 'E', 'F', 'L', 'D' Logical OR of condition to check AllowFileMask="EF"; AllowFileMask="EFD"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

RefuseStatus
HTTP status code to set if the conditions specified by AllowFileMask are not met. Typically this would be '404' for resource not found, or '403' for forbidden.
AllowFileMask
A group of letters indicating which properties of the physical resource to check.
Option flag Meaning
E Resource must exist
F Resource is a regular file
D Resource is a directory
L Resource is a symbolic link
These flags are not case sensitive.

Phase:
CHECKPATH

Returns:
INT_REDIRECT (via HTTPUtil_doHTTPError()) to cause the HTTP error specified by RefuseStatus to occur if the conditions specified by AllowFileMask are not met. Otherwise PIAPI_CONTINUE is returned to allow other path checking handlers to be invoked. PIAPI_ERROR is returned if this handler is used to respond to a phase other than 'CHECKPATH'.

Example:

	<Object>
		Name RefuseFileByMask
		Class RefuseFileByMaskClass
	</Object>

	<Object>
		...
		CheckPath RefuseFileByMask AllowFileMask="EF" RefuseStatus=404
		...
	</Object>

	

:


Name:
ReturnCode

Description:
Returns the specified error code. This handler can be used to 'fake' a response to a phase, or to otherwise cause the specified return code to be given.

Options:

Overview
Option Default Values Short Description Example(s)
ReturnCode + COMPLETED, CONTINUE, REDIRECT, ERROR, ABORT Specify a handler return code ReturnCode="COMPLETED"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

ReturnCode
Specifies the return code that will be returned from this handler. This handler takes no other action.

Phase:
Any

Returns:
The specified return code.

Note:

Example:

	<Object>
		Name ReturnCode
		Class ReturnCodeClass
	</Object>

	<Object>
		...
		CheckAuth ReturnCode ReturnCode="COMPLETED"
		...
	</Object>

	

:


Name:
SendErrorMessage

Description:
This handler object sends specific canned error message text for each HTTP error status code.

Options:

Overview
Option Default Values Short Description Example(s)
IgnoreStatus - 0, 200, etc. HTTP response codes IgnoreStatus="0 200"
<nnn> - Fragments/404.html, msgs/403.html, etc. Response specific error messages 404="Fragments/404.html"; 403="msgs/403.html"
DefaultMessage + Fragments/Unknown.html, mgs/unknown.html, etc. Default error message DefaultMessage="Framents/Unknown.html"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

IgnoreStatus
HTTP response codes which should not be considered errors. This field takes the form of a sequence of 3 digit decimal codes seperated by spaces. NOTE: Typically the values 0 and 200 will always be included.
<nnn>
This directive is used to specify the error message file to be sent for a specific status code.
DefaultMessage
The default error message. This is used for status codes which have not been specified as ignorable, but which have not been explicitly defined.

Phase:
HANDLE

Returns:
PIAPI_COMPLETED on success. PIAPI_CONTINUE if no action taken. PIAPI_ERROR and PIAPI_ABORT respectively for generic and severe error conditions.

Example:

	<Object>
		Name SendErrorMessage
		Class SendErrorMessageClass
		IgnoreStatus "0 200"
	</Object>

	<Object>
		...
		Handle SendErrorMessage DefaultMessage="Fragments\Unknown.html" 403="Fragments\Forbidden.html"
		...
	</Object>
	

:


Name:
SendFile

Description:
Send a file including headers to a remote client. If this is a 'HEAD' request only the HTTP headers will be sent. HeaderPattern - A Pi3Expression Output first HeaderPattern="The Title" FooterPattern - A Pi3Expression Output last FooterPattern="" - in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

HeaderPattern
Specifies a pattern of data that will be pre-appended to the file.
FooterPattern
Specifies a pattern of data that will be appended to the file.

Phase:
HANDLE

Returns:
PIAPI_COMPLETED if the file was sent. If this handler was invoked for a phase other than HANDLE then PIAPI_ERROR is returned.

Note:

Example:

	<Object>
		Name SendFile
		Class SendFileClass
	</Object>

	<Object>
		...
		Handle SendFile
		...
	</Object>

	

:


Name:
SendPi3Expression

Description:
This handler object evalulates and sends a Pi3Expression to a the client. By default this handler will send the result in the context of a single-bodied response to the client. This default can be overriden so this handler sends one content-body of a mulipart response.

Options:

Overview
Option Default Values Short Description Example(s)
Pi3Expression + A Pi3Expression Pi3Expression to be sent "Process [$P], Thread [$k]"
InMultipartResponse No Yes, No Multipart response indicator InMultipartResponse=Yes
BufferSize -1 A decimal number Maximum message length BufferSize=4096
HTTPEquiv - "<rfc822_variable>: <content>" HTTP Entity header "Content-Type: text/html"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

Pi3Expression
A full Pi3Expression to be evaluated and sent to the remote client.
InMultipartResponse
Specify whether or not the response is part of a multipart response. This handler object specifies a multipart response differently from a single

response in the following way:
The handler will not return PIAPI_COMPLETED, but PIAPI_CONTINUE, to allow multiple responses to be listed in order for the HANDLE phase. Only the entity headers will be send to the client (Content-Type, Content-Length, etc.) not the general headers (Server, Connection etc.). The seperator header willl be sent as appropriate. The values 'Yes' or 'No' (not case sensitive) may be used.

BufferSize
Specify the maximum message length that may be sent to the client. Expressions which evaluate to greater than this length will be truncated. A value of -1 specifies no limit.
HTTPEquiv
Specify additional rfc822 headers to send to the client. Any headers given override default headers set by this handler, i.e. 'Content-Length' and 'Content-Type'. Care must be taken so that addition of headers would cause the HTTP protocol as specified to be violated. In particular, the 'Content-Length' header should not be specified.

Phase:
HANDLE

Returns:
PIAPI_COMPLETED on success if InMultiPartResponse is 'No'. PIAPI_CONTINUE if no action taken or on success and InMultiPartResponse is 'Yes'. PIAPI_ERROR and PIAPI_ABORT respectively for generic and severe error conditions.

Example:

	<Object>
		Name SendPi3Expression
		Class SendPi3ExpressionClass
		BufferSize 128
		HTTPEquiv "Content-Type: text/plain"
	</Object>

	<Object>
		...
		Handle SendPi3Expression \
			Pi3Expression="Hello, your computer's hostname is $h."
		...
	</Object>

	

:


Name:
SendSSI

Description:
Parse and send server-side includes.

Options:

Overview
Option Default Values Short Description Example(s)
Exec No 'Yes' or 'No' Specific whether CGI scripts may be executed Exec="Yes"
HeaderPattern - A Pi3Expression Output first before the page HeaderPattern="The Title"
FooterPattern - A Pi3Expression Output last FooterPattern=""
ExecFileFixup - A Pi3Expression Evaluated to fixup CGI markers ExecFileFixup="&dbreplace(response,string,ObjectMap,Scripts)"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

Exec
Specify whether or not CGI scripts may be executed as part of SSI processing. Comparision with 'Yes' or 'No' is not case sensitive.
HeaderPattern
Specifies a pattern of data that will be pre-appended to the file.
FooterPattern
Specifies a pattern of data that will be appended to the file.
ExecFileFixup
For exec ssi directives with the file specified via 'file=' this pattern is evaluated to allow a user defined Pi3Expression to cause markers to be set. This is because virtual path processing would normally set markers to indicate which CGI handler to use, but 'file=' bypasses the virtual path mapping phase.

Note:

Phase:
HANDLE

Returns:
PIAPI_COMPLETED if the file was sent. If this handler was invoked for a phase other than HANDLE then PIAPI_ERROR is returned.

Example:

	<Object>
		Name SendSSI
		Class SendSSIClass
	</Object>

	<Object>
		...
		Handle SendSSI Exec="Yes" 
		...
	</Object>

	

:


Name:
StatusCode

Description:
Cause the given status code to be set for this handler.

Options:

Overview
Option Default Values Short Description Example(s)
StatusCode + An HTTP response code in 3 digital decimal form Specify an HTTP reponse code to be set StatusCode="403"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

StatusCode
Specifies the status code to be set by this handler.

Phase:
Any

Returns:
PIAPI_COMPLETED.

Note:

Example:

	<Object>
		Name StatusCode
		Class StatusCodeClass
	</Object>

	<Object>
		...
		CheckAccess StatusCode StatusCode="403"
		...
	</Object>

	

:


Name:
VirtualHost

Description:
A virtual host object is a placeholder for variable-value attribute pairs associated with virtual hosts. This object creates its own PIDB and stores parameters in it for reference. A pointer to this PIDB is access by other parts of the HTTP server via the GetHostDB() method of the PIHTTP object.

Options:
Ad hoc options. All parameters are stored in this object PIDB with type PIDBTYPE_RFC822.

Phase:
No phase. It is an error to invoke this object as part of phase handling.

Returns:
PIAPI_ERROR always, because this is not a handler.

Example:

	<Object>
		Name VirtualHost
		Class VirtualHostClass
		HostName "host1"
		Administrator "jroy@johnroy.com"
	</Object>

	

:


Name:
VirtualHostByAddress

Description:
Some operating systems allow multiple IP address to be used by the same computer. On such systems it is possible to have multiple HTTP servers simulated by the same server by customizing the servers behaviour depending on the local IP address to which the client is bound. This handler allows the requests virtual host object to be changed depending on the local IP address of the request.

Options:

Overview
Option Default Values Short Description Example(s)
VirtualHostObject + <objectname> VirtualHost object to associate VirtualHostObject="vhost1"
BindAddress + IP address of form www.xxx.yyy.zzz Server bound IP address BindAddress="172.23.23.37"
BindAddressVariable "LocalAddr" Variable name IO object variable name BindAddressVariable="LocalAddr"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

VirtualHostObject
Specifies the virtual host object that will be associated with the request if the local IP address matches the IP address given by the 'BindAddress' parameter.
BindAddress
Specifies the IP address to match against the connection&qts local IP address.
BindAddressVariable
Give the variable name which stores the connections local bind address in the connection IO object, this would typically be 'LocalAddr'.

Phase:
HOSTMAP

Example:

	<Object>
		Name VirtualHostByAddress
		Class VirtualHostByAddressClass
		BindAddressVariable "LocalAddr"	
	</Object>

	<Object>
		...
		VirtualHost VirtualHostByAddress VirtualHost="host1.foo.dom" \
			BindAddress=120.0.0.1
		...
	</Object>

	

:


Name:
VirtualHostByName

Description:
This handler allows the virtual host to be changed by filtering the 'Host' rfc822 header field sent by the browser.

Options:

Overview
Option Default Values Short Description Example(s)
VirtualHostObject + <objectname> VirtualHost object to associate VirtualHostObject="vhost1"
HostName + A hostname Hostname of virtual host. Hostname="foo.name.dom"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

VirtualHostObject
Specifies the virtual host object that will be associated with the request if the client supplied 'Host' HTTP header matches the specified hostname.
Hostname
Specifies a hostname for the virtual host.

Phase:
HOSTMAP

Example:

	<Object>
		Name VirtualHostByName
		Class VirtualHostByNameClass
		BindAddressVariable "LocalAddr"	
	</Object>

	<Object>
		...
		VirtualHost VirtualHostByName VirtualHost="host1.foo.dom" \
			HostName="host1.foo.dom"
		...
	</Object>

	

:


Name:
VirtualHostByURL

Description:
This handler allows the virtual host to be changed by remaping the the begining of the URL path from the client.

Options:

Overview
Option Default Values Short Description Example(s)
VirtualHostObject + <objectname> VirtualHost object to associate VirtualHostObject="vhost1"
URLPath + A URL Path fragment The URL path to use URLPath="/vhost1/"
- in the default indicates no default
+ in the default indicates the field is mandatory

Description of Options

VirtualHostObject
Specifies the virtual host object that will be associated with the request if the client supplied 'Host' HTTP header matches the specified hostname.
URLPath
Specifies the URL path to match. If this handler matches the begining of the URL path, correctly, the matched portion will be removed from the URL to make the URLPath based virtual hosting transparent to other phases.

Phase:
HOSTMAP

Example:

	<Object>
		Name VirtualHostByURL
		Class VirtualHostByURLClass
		BindAddressVariable "LocalAddr"	
	</Object>

	<Object>
		...
		VirtualHost VirtualHostByURL VirtualHost="host1.foo.dom" \
			URLPath="/host1/"
		...
	</Object>