iTP Secure WebServer System Administrator's Guide (Version 7.0)
Using Common Gateway Interface (CGI) Programs
iTP Secure WebServer System Administrator’s Guide—523346-012
8-32
Pathway CGI Coding Considerations
Pathway CGI Coding Considerations
The considerations for coding a Pathway CGI application include requirements for 
including the CGI library and design guidelines for the NonStop TS/MP execution 
environment.
Including the CGI Library
Your application must include the cgilib.h file, illustrated in Example 8-2. If the 
application consists of multiple modules, all except the CGI_main module should 
precede the include using this define:
#define _CGI_NO_EXTERNALS
CGI_puts() This procedure writes a string to the CGI output stream. It 
operates in the same way as its Posix equivalent.
CGI_connection_abort This stub procedure is called whenever the connection between 
the CGI server and the httpd program is broken; usually, when the 
end user at the Web client stops an active data transfer prior to 
receiving all the data being sent, or when there is an internal 
timeout within the httpd server itself, in the case where a single 
connection has existed longer than its configured lifetime. An 
internal timeout might occur if the ScriptTimeout / InputTimeout 
/OutputTimeout values are configured. When an internal timeout 
occurs, httpd cancels the request, closes the connection, and 
sends a termination signal to the CGI process. The CGI library 
invokes the CGI_connection_abort procedure to handle the 
termination signal.
The intent of a user-coded connection abort routine is to allow for 
graceful cleanup of transactions in progress.
CGI_initialize() This stub procedure is called each time the server comes up to 
allow user-written initialization code (such as opening database 
files) to be executed at startup time. You must use this function in 
order to read environment variables. (See Design Guidelines
 on 
page 8-33.)
CGI_terminate This stub procedure is called before the server stops or aborts to 
allow user-written cleanup code to be executed prior to process 
termination.
Table 8-6. CGI Procedures (page 3 of 3)
Procedure Description










