cgi-overview.tmpl
1/* -*-html-*- */
2/*
3 * $Id: cgi-overview.tmpl,v 1.6 2004/06/29 15:13:15 sbooth Exp $
4 *
5 * Copyright (C) 1996 - 2004 Stephen F. Booth <sbooth@gnu.org>
6 * Part of the GNU cgicc library, http://www.cgicc.org
7 *
8 * Permission is granted to copy, distribute and/or modify this document
9 * under the terms of the GNU Free Documentation License, Version 1.1
10 * or any later version published by the Free Software Foundation;
11 * with no Invariant Sections, with no Front-Cover Texts, and with
12 * no Back-Cover Texts.
13 * A copy of the license is included in the section entitled "GNU
14 * Free Documentation License".
15 */
16
17/*! \page cgi_overview Overview of the Common Gateway Interface
18
19\htmlonly
20<div class="header">What is the Common Gateway Interface?</div>
21<div class="subsection">
22\endhtmlonly
23
24The Common Gateway Interface (CGI) is a standard for external gateway
25programs to interface with information servers, such as HTTP
26servers. The official specification for the Common Gateway
27Interface may be found at http://hoohoo.ncsa.uiuc.edu/cgi/interface.html
28
29\htmlonly
30</div>
31\endhtmlonly
32
33\htmlonly
34<div class="header">CGI scripts or CGI applications?</div>
35<div class="subsection">
36\endhtmlonly
37
38Historically, many CGI applications were written in scripting languages
39such as Perl. Not surprisingly, CGI code called by the HTTP server was
40referred to as a CGI \e script. As the popularity of the web grew
41and the need for dynamic content increased, CGI applications written in
42languages other than Perl became more and more popular. These
43applications were referred to simply as scripts. Although the term
44script does not make intuitive sense for a compiled program, the
45term has stuck. In this manual, the terms \e script and
46\e application are used interchangeably.
47
48\htmlonly
49</div>
50\endhtmlonly
51
52\htmlonly
53<div class="header">CGI Processing</div>
54<div class="subsection">
55\endhtmlonly
56
57When an HTTP server receives a request for a CGI script, the
58server communicates to the script the details of the request. The
59HTTP server and a CGI script communicate in four major ways:
60
61<ol>
62<li><strong>Environment variables</strong>
63The HTTP server uses environment variables to pass information
64about the request to the CGI script. Depending on the type of
65request, the environment variables may or may not contain all the
66information required by the script to function properly.</li>
67
68<li><strong>The command line</strong>
69The command line is only used for \c isindex queries. Generally,
70\c isindex queries should not be used; since the command line is used
71directly, they present many potential security risks.</li>
72
73<li><strong>Standard input</strong>
74For HTTP \c POST or \c PUT queries, the HTTP server communicates
75information to the CGI script via standard input. The amount of
76information written to standard input is stored in the
77\c CONTENT_LENGTH environment variable.</li>
78
79<li><strong>Standard output</strong>
80A script returns its output on standard output. The output can be a
81document generated by the script, or instructions to the server for
82retrieving the desired output.</li>
83</ol>
84
85\htmlonly
86</div>
87\endhtmlonly
88
89\htmlonly
90<div class="nav">
91\endhtmlonly
92Previous: \ref index |
93Current: \ref cgi_overview |
94Next: \ref lib_overview
95\htmlonly
96</div>
97\endhtmlonly
98*/