home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Webmaster in a Nutshell

Previous Chapter 14
Windows CGI
Next
 

14.3 Results Processing

The CGI program returns its results to the server as a data stream representing (directly or indirectly) the goal of the request. The data stream consists of two parts: the header and the body. The header consists of one or more lines of text, and is separated from the body by a blank line. The body contains MIME-conforming data whose content type must be reflected in the header.

The server recognizes the following header lines in the results data stream:

Content-Type:

Indicates that the body contains data of the specified MIME content type. The value must be a MIME content type/subtype.

URI: <value> (value enclosed in angle brackets)

The value is either a full URL or a local file reference, either of which points to an object to be returned to the client in lieu of the body. If the value is a local file, the server sends it as the results of the request, as though the client issued a GET for that object. If the value is a full URL, the server returns a "401 redirect" to the client to retrieve the specified object directly.

Location:

Same as URI, but this form is now deprecated. The value must not be enclosed in angle brackets with this form.

Any other headers in the result stream are passed unmodified by the server to the client. It is the responsibility of the CGI program to avoid including headers that clash with those used by HTTP.

Direct Return

The server provides for the CGI program to return its results directly to the client, bypassing the server's "packaging" of the data stream for its information protocol. In this case, it is the responsibility of the CGI program to generate a complete message packaged for HTTP.

The server looks at the results in the output file, and if the first line starts with "HTTP/1.0", it assumes that the results contain a complete HTTP response, and sends the results to the client without packaging.


Previous Home Next
The CGI Data File Book Index Perl Quick Reference

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell