HP e3000 Web Server CGI Programming (November 2008)
create a CGI program or script that the Web daemon will execute to transmit information to the
database engine, and receive the results back and display them to the client. This is an example of a
gateway and is the origin of CGI.
Figure 2. Common Gateway Interface
Any program, in any language can serve as a CGI program as long as it follows these rules:
The program reads standard input (STDIN) and writes to standard output (STDOUT). (See
Section II for a discussion on CGI with various programming languages.)
The CGI program/script must reside in a CGI directory (usually cgi-bin) on the HP 3000 Web
server. For example, < http://jazz.external.hp.com/cgi-bin/omi_registration > refers to a CGI
program in /cgi-bin on the JAZZ HP3000 web server.
Note: Some Web servers (Netscape, for example) allow CGI programs to be specified with a
particular extension (eg:
*.cgi indicates a CGI program irrespective of where it resides). However, the
Open Market WebServer for the HP 3000 requires all CGI programs to reside in the /cgi-bin directory.
Most uses of CGI scripts are for processing input from Forms. Forms are HTML pages with GUI
elements such as buttons, text fields, listboxes, etc. Every form is composed of two parts:
The HTML code for the form which the user sees displayed on the browser.
The CGI script running on the web server which processes the contents of the form.
The typical sequence of steps of a CGI script is:
1. Read the contents of the form from STDIN
2. Do processing based on the form data
3. Write the HTML response to STDOUT/STDLIST.
Web protocol has a stateless architecture. A request is made to the server from the client, the
information is provided and the connection is dropped. The Web server itself has no way of
"remembering" the request. This is standard Web behavior. It is not a problem as long as a complete
transaction is contained within a single Web client to Web server connection. However, most
applications are more complex and assume that the user is directly connected to the server and that
the server is "aware" and "keeping track" of the user. This is a "state-oriented" environment.
Page
2
of
10
HP e3000 Web Server CGI Programming
11/13/2008
http://www.hp.com/cgi
-
bin/pf
-
new.cgi?IN=http://jazz.external.hp.com/papers/cgi
-
paper/c
...