meta-variables. The SCRIPT_NAME and PATH_INFO values, URL-encoded
with ";", "=" and "?" reserved, give <script-path> and .
RFC 3875 CGI Version 1.1 October 2004
See section 4.1.5 for more information about the PATH_INFO
The scheme and the protocol are not identical as the scheme
identifies the access method in addition to the application protocol.
For example, a resource accessed using Transport Layer Security (TLS)
 would have a request URI with a scheme of https when using the
HTTP protocol . CGI/1.1 provides no generic means for the script
to reconstruct this, and therefore the Script-URI as defined includes
the base protocol used. However, a script MAY make use of
scheme-specific meta-variables to better deduce the URI scheme.
Note that this definition also allows URIs to be constructed which
would invoke the script with any permitted values for the path-info
or query-string, by modifying the appropriate components.
The script is invoked in a system-defined manner. Unless specified
otherwise, the file containing the script will be invoked as an
executable program. The server prepares the CGI request as described
in section 4; this comprises the request meta-variables (immediately
available to the script on execution) and request message data. The
request data need not be immediately available to the script; the
script can be executed before all this data has been received by the
server from the client. The response from the script is returned to
the server as described in sections 5 and 6.
In the event of an error condition, the server can interrupt or
terminate script execution at any time and without warning. That
could occur, for example, in the event of a transport failure between
the server and the client; so the script SHOULD be prepared to handle
4. The CGI Request
Information about a request comes from two different sources; the
request meta-variables and any associated message-body.
4.1. Request Meta-Variables
Meta-variables contain data about the request passed from the server
to the script, and are accessed by the script in a system-defined
manner. Meta-variables are identified by case-insensitive names;
there cannot be two different variables whose names differ in case
only. Here they are shown using a canonical representation of
capitals plus underscore ("_"). A particular system can define a
RFC 3875 CGI Version 1.1 October 2004
meta-variable-name = "AUTH_TYPE" | "CONTENT_LENGTH" |
"CONTENT_TYPE" | "GATEWAY_INTERFACE" |
"PATH_INFO" | "PATH_TRANSLATED" |
"QUERY_STRING" | "REMOTE_ADDR" |
"REMOTE_HOST" | "REMOTE_IDENT" |
"REMOTE_USER" | "REQUEST_METHOD" |
"SCRIPT_NAME" | "SERVER_NAME" |
"SERVER_PORT" | "SERVER_PROTOCOL" |
"SERVER_SOFTWARE" | scheme |
protocol-var-name | extension-var-name
protocol-var-name = ( protocol | scheme ) "_" var-name
scheme = alpha *( alpha | digit | "+" | "-" | "." )
var-name = token
extension-var-name = token
Meta-variables with the same name as a scheme, and names beginning
with the name of a protocol or scheme (e.g., HTTP_ACCEPT) are also
defined. The number and meaning of these variables may change
independently of this specification. (See also section 4.1.18.)
The server MAY set additional implementation-defined extension meta-
variables, whose names SHOULD be prefixed with "X_".
This specification does not distinguish between zero-length (NULL)
values and missing values. For example, a script cannot distinguish
between the two requests http://host/script and http://host/script?
as in both cases the QUERY_STRING meta-variable would be NULL.
meta-variable-value = "" | 1*<TEXT, CHAR or tokens of value>
An optional meta-variable may be omitted (left unset) if its value is
NULL. Meta-variable values MUST be considered case-sensitive except
as noted otherwise. The representation of the characters in the
meta-variables is system-defined; the server MUST convert values to