The CGI application must send a parsed header to it's standard output which is intercepted by the web server. From the parsed header, the web server will create the required non-parsed HTTP response header to be sent to the client. The parsed header must contain a server directive which may include one or more of:

Content-type - Indicates the MIME type of the data being sent back to the client.

The CGI application may also send a HTTP response header. The server creates a non-parsed header from the CGI parsed information and sends it to the client. The following is a valid non-parsed header: "

Using the client to call a CGI application

Methods for a client to call a CGI application:

An action attribute in an HTML FORM tag specifies the CGI application to run when the user presses the FORM submit button. As described in the introduction, the POST or GET methods may be used to send the data. The data is sent as part of the standard input or as the QUERY_STRING if POST or GET are used respectively.

Server-side includes. The Form of a SSI statement as found on an HTML page:

<!--#exec cgi="/cgi-bin/hits.pl"-->

The output from the server side include script is plcaed into the HTML page at the location where the SSI call was made. See the SSI manual for maor information on server side includes.

An HTML IMG tag may be used to indirectly call the CGI application with a line like the following:

<IMG SRC="/cgi-bin/image">

It is expected that the CGI program will generate an image to be sent back to the client web browser. See the "Printing a File" section in the Perl manual for an example about how to do this.

Client side script programs embedded into the HTML page such as JavaScript may be used to call a CGI application program.