CGI: Output
Scripts return their results either outputting a document to their
standard output, or by outputting the
location of the
result document (either a full URL or a local virtual path).
The script sends its output to stdout: either a
document generated by the script, or instructions to the server for
retrieving the desired output.
The back-end returns its results to the server as a data stream.
The server is responsible for "packaging" the data stream according to
HTTP,
and for using HTTP to
transport the data stream to the requesting client.
The
server normally adds the needed HTTP headers to the back-end's results.
The data stream consists of two parts:
- 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 does not interpret or modify the body in any way.
CGI Output Example
print <<EOT;
Content-type: text/html
<HTML> <HEAD>
<TITLE> Search Results</TITLE>
</HEAD>
<BODY> <H1> Search Results </H1>
EOT
|
|