The Common Gateway Interface (CGI) is a standard for external gateway programs to interface with information servers, such as HTTP servers. The official specification for the Common Gateway Interface may be found at http://hoohoo.ncsa.uiuc.edu/cgi/interface.html
Historically, many CGI applications were written in scripting languages such as Perl. Not surprisingly, CGI code called by the HTTP server was referred to as a CGI script. As the popularity of the web grew and the need for dynamic content increased, CGI applications written in languages other than Perl became more and more popular. These applications were referred to simply as scripts. Although the term script does not make intuitive sense for a compiled program, the term has stuck. In this manual, the terms script and application are used interchangeably.
When an HTTP server receives a request for a CGI script, the server communicates to the script the details of the request. The HTTP server and a CGI script communicate in four major ways:
isindex
queries. Generally, isindex
queries should not be used; since the command line is used directly, they present many potential security risks.
POST
or PUT
queries, the HTTP server communicates information to the CGI script via standard input. The amount of information written to standard input is stored in the CONTENT_LENGTH
environment variable.