CGI Environment Variables


In order to pass data about the information request from the server to the script, the server uses command line arguments as well as environment variables. These environment variables are set when the server executes the gateway program.


Specification

The following environment variables are not request-specific and are set for all requests:


The following environment variables are specific to the request being fulfilled by the gateway program:


In addition to these, the header lines recieved from the client, if any, are placed into the environment with the prefix HTTP_ followed by the header name. Any - characters in the header name are changed to _ characters. The server may exclude any headers which it has already processed, such as Authorization, Content-type, and Content-length. If necessary, the server may choose to exclude any or all of these headers if including them would exceed any system environment limits.

An example of this is the HTTP_ACCEPT variable which was defined in CGI/1.0. Another example is the header User-Agent.


Examples

Examples of the setting of environment variables are really much better demonstrated than explained.


Return to the interface specification

Rob McCool robm@ncsa.uiuc.edu