iTP Secure WebServer System Administrator's Guide (iTPWebSvr 6.0+)
Using Common Gateway Interface (CGI) Programs
iTP Secure WebServer System Administrator’s Guide—523346-002
8-31
CGI Library
CGI Library
A CGI program to be invoked by the generic-CGI server class uses standard functions,
such as C library functions, for access to the standard file environment.
A Pathway CGI application uses the CGI library for access to standard files. Table 8-6
lists and describes the procedures in the CGI library.
Table 8-6. CGI Procedures (page 1 of 3)
Procedure Description
CGI_Capture() This procedure decodes the name/value pairs encoded in form
data returned by the POST request method or in the
QUERY_STRING returned by the GET request method, creates
an environment variable for each name/value pair and sets the
value of the variable. CGI_Capture() may be called in lieu of
placing the Region directive AddCGI
AUTOMATIC_FORM_DECODING ON command in the server’s
configuration file.
CGI_feof() This procedure is analogous to the feof() procedure in the C
library: It tests for the end-of-file condition on a specified stream
and returns a nonzero value if it encounters the end-of-file.
CGI_fgets() This procedure is analogous to the fgets() procedure in the C
library. The CGI_fgets() function reads data from the stream
pointed to by the stream parameter into the array pointed to by the
string parameter. Data is read until n-1 bytes have been read, a
newline character is read, or an end-of-file condition is
encountered. The string represented by the data is then
terminated with a NULL character.
CGI_main() This procedure is used as an entry point into a user-written CGI
server class. The CGI environment changes on each invocation of
CGI_main. (See Design Guidelines
on page 8-34.)
CGI_printf() This procedure is analogous to the printf() procedure in the C
library, with one exception: output is passed back to the CGI client
program through the Pathway CGI interface rather than to the
stdout file descriptor.
The maximum size of the write buffer (including expansion of
elements such as integers) is 32000 bytes. If the printf string
exceeds this size, the application terminates with an error
message.
CGI_fread() This procedure is analogous to the fread() procedure in the C
library with the following exceptions:
Data is read from the Pathway CGI interface rather than from
stdin, and stdin is the only file descriptor that this procedure may
be called with.