Linux HomeVision Web Server Plugin

The Web Server plugin provides basically the same functionality as the Web Server of the Windows HomeVision software. In addition it supports cgi script execution.

Basic operation

The web server responds to incoming requests from web browsers. Such a request specifies a Universal Resource Identifier (URI) and possibly some additional post data generated from a HTML form. A URI consists of a number of distinctive parts:
  1. The naming scheme of the mechanism used to access the resource.
  2. The name of the machine hosting the resource.
  3. The port number handling access to the resource (optional).
  4. The name of the resource itself, given as a path.
  5. The fragment identifier, specifying a location within the resource (optional).
  6. A query string containing additional data to be forwarded to the resource (optional).
An example of a URI containing all the parts is: The different parts of this URI are:
  1. http
  2. localhost
  3. 1033
  4. index.cgi
  5. information
  6. device=HomeVision
The other characters in the URI are needed to be able to unambiguously distinguish the different parts.

The web server plugin is only able to handle URIs for the HTTP mechanism. The hostname has to refer to the machine the web server is running on. The port number can be configured on the web server configuration dialog.

In addition to the standard tags that may be present in a HTML document, the web server plugin will scan the document for special HV tags and substitute the appropriate text. For details, see the Windows HomeVision documentation for the web browser. Also the methods for performing actions on the HomeVision controller described there work with the web server plugin.

Dynamically generated resources

The web server plugin is not only able to return static HTML pages, it can also run executable (CGI) programs or scripts that generate a page on the fly. The plugin recognizes a few file extensions that indicate the type of resource:
.html and .htm
These are the usual HTML formatted files.
.txt
Plain text without embedded formatting information.
.css
Cascading style sheet definitions.
.gif, .jpg, .jpeg and .png
Different image formats.
Any other file will be checked to determine if it is executable. If it is, it will be executed and the standard output and standard error of the process are returned to the web browser that initiated the request.

The executable generating the dynamic web pages may be written in any programming- or scripting language available on the machine that runs the web server. Examples: sh script, tcl script, perl script, compiled C program, etc. The output of the program must start with one or more lines that complete the response header. In its simplest form this is just an empty line indicating the end of the response header. All other lines of the response header must contain an identifier, a colon and a value. Anything else will result in an error.

The default mime type associated with a dynamic web page is text/html. A CGI program can change this by including the Content-Type identifier in the response header. Example: To indicate plain text content the output of the program should start with:

Other useful identifiers that can be used in the response header are: Useful (and less useful) information is passed to the CGI program through the environment and the standard input of the program. Below is alist of the most important variables:
PATH
The search path for commands. It is a colon-separated list of directories in which the shell looks for commands.

REQUEST_METHOD
Indicates the way additional data is passed to the resource. Possible values are

QUERY_STRING
The query string part of the URI.

CONTENT_LENGTH
The number of bytes of data available on the standard input. This variable only exists for POST requests.

HTTP_REFERER
The web page that contains the link that was followed to reach this page.

Posted data is always first parsed by the web server plugin to check for any special HomeVision actions tags. The appropriate actions are executed before the CGI program is started. If the output of the CGI program has a mime type of text/html, the output is scanned for HV information tags. These tags are automatically replaced by the specified information. For all other mime types the output of the CGI program is passed unaltered.

Any CGI program running longer than 5 minutes is assumed to be stuck in a loop and will be killed.

Last modified: 6 April 2003, 11:50 CEST