CGI Handler    

MIME Types: application/x-vnd.CGI

Methods: *

Priority: 10

Suggested Virtual Resources:

Virtual Resource Extras: None

The CGI Handler is compliant with the CGI 1.1 Internet Draft 01. It will attempt to execute the resource specified in the URL and return the output of the sub-process. Parsed Header Output as well as Non-Parsed Header Output are supported by the CGI Handler. All standard CGI envrionment variables are made available to the sub-process. The CGI handler can execute any scripts which can be executed from the shell. This includes compiled binaries, shell scripts, Perl, and any other scripting language you may have installed. To use Perl you will have to install Perl on your computer. You can find Perl for BeOS at BeBits.

Compiled CGIs should run without needing any modification. If the CGI is written in a scripting language such as a shell script or Perl, you may need to modify the script to get it to run. The first line of such a script tells the shell which program to use to interpret the script. This line is known as the "shebang" line. It has the following form: #!path
"path" is the absolute path of the script interpreter. For example, the shebang line for a shell script would be #!/bin/sh. You can find the path for Perl by typing "which perl" at the command line. This will probably give you "/boot/home/config/bin/perl" or something similar under BeOS. The following is a sample shell script CGI which will print the output of the fortune program:

#!/bin/sh
echo Content-type: text/plain
echo
	
/bin/fortune
	
Some Non-Parsed Header CGIs may cause trouble with HTTP/1.1 clients. HTTP/1.1 clients maintain persistant connections by default and if the CGI does not send a "Content-Length" header or a "Connection: close" header, the client may become confused as to the content length of the response.

Visit the CGI Resources web site for more information on using and writing CGIs. They also maintain an index of useful CGI scripts you may wish to use.


Robin Hood Web Server for BeOS
Copyright © 1999-2001
The Robin Hood Development Team (see Revision History for details)

BeOS is a registered trademark of Be Inc.