Topics of this chapter include:
Welcome to Slinger, a WWW server for resource-constrained environments. Slinger is compliant with the CGI 1.1 and HTTP 1.1 standards, and provides support for dynamic HTML via Server Side Includes (SSI).
When you install the Slinger software, the install program puts the Slinger executables in the /usr/ucb/slinger directory. To run Slinger, just type:
slinger & |
You need to run Slinger as root since Slinger communicates on a privileged port by default. As soon as Slinger has attached to the HTTP port, it drops itself down to user -2 (setuid(-2)). |
For information about Slinger options, see the slinger utility page.
Much of Slinger's configuration is done with environment variables. Slinger provides Server Side Include (SSI) commands to support dynamic HTML. For example, Slinger uses the PATH and CMD_INT environment variables to provide information to the SSI command, exec.
See the "Security precautions" section for configuration issues. |
Don't use /bin or /usr/bin as your CGI directory. |
These precautions will prevent somebody from giving your machine a new password file or tampering with your web pages.
We recommend that you put your documents and scripts in separate directories. In this example, the documents are in the /usr/webdoc directory, the root document is foo.html, and the CGI scripts are in /usr/web/cgi.
export HTTPD_ROOT_DIR=/usr/webdoc export HTTPD_ROOT_DOC=foo.html export HTTPD_SCRIPTALIAS=/usr/web/cgi slinger &
In this example, anyone can download the scripts because the documents and scripts are in the same directory.
export HTTPD_ROOT_DIR=/usr/web export HTTPD_ROOT_DOC=foo.html export HTTPD_SCRIPTALIAS=/usr/web slinger &
Slinger supports Server Side Include (SSI) commands to provide dynamic HTML. For example, Slinger uses the PATH and CMD_INT environment variables to provide information to the SSI command, exec. Using dynamic HTML, clients can offer interactive realtime features on their web pages.
Clients code dynamic HTML by placing SSI tokens in the HTML code of their web pages. The SSI token contains an SSI command that is handled by Slinger. While transmitting the HTML code, Slinger replaces a token with HTML data based on the tag contained in the SSI token.
The HTML file must have the file extension .shtml |
The syntax of an SSI token is as follows:
<!--#tag [[variable set[="value"]] ...] -->
where:
There must be a space before the ending comment delimiter. |
There's no limit to the token size (other than memory).
Here's a brief summary of the SSI commands Slinger provides:
Detailed information about each token is available in the slinger utility page.
HTML can be dynamically generated in order to support changing systems. The main components in such a system are:
There are three ways to provide dynamic HTML:
The data server process stores global data. External applications can modify or read this global state through the use of the data server API. Slinger can modify or read the global state via the qnxvar SSI command.
Here's a conceptual view of a device monitored and controlled by both an external application and a remote client of Slinger:
Using the data server.
To use dynamic HTML: