Consequentialism
The variable of environment cgi are variable S transmitted to a program cgi, by the Web server calling upon it, during its execution.
They provide information on the request carried out by the customer, on the waiter and also on the customer himself. For example, when one carries out a research on a site which functions with cgi , script recovers the research topics with the variable of environment “QUERY_STRING”.
List variables cgi
Variables in connection with the waiter
the name and the version of the
Waiter HTTP answering the request. (Format: name/version)
the Host name, alias DNS or Address IP of the waiter.
the revision of the specification cgi which the waiter uses. (Format: CGI/révision)
Variables specific to the request
the name and the revision of the protocol in which the request was made (Format: protocol/revision)
the number of
port on which the request was sent.
method used to make the request. For HTTP, it generally contains “GET” or “POST”.
the additional way of script as given by the customer. For example, if the waiter lodges script “/cgi-bin/monscript.cgi” and that the customer asks for the URL “
http://serveur.org/cgi-bin/monscript.cgi/marecherche ”, then
PATH_INFO contains “marecherche”.
Contient the way requested by the customer after conversions virtual → physical were made by the waiter.
the virtual way towards script being carried out. Example: “/cgi-bin/script.cgi”
Contient all that follows it “? ” in the URL sent by the customer. All the variables coming from a form sent with method “GET” will be contained in
QUERY_STRING in the form “var1=val1&var2=val2&… ”.
the host name of the customer. If the waiter does not have this information (for example, when the opposite resolution DNS is decontaminated),
REMOTE_HOST will be empty.
the Address IP of the customer.
the type of identification used to protect script (if it is protected and if the waiter supports the identification).
the name of user of the customer, if script is protected and if the waiter supports the identification.
Name of user (distant) of the customer making the request. The waiter must support the identification RFC 931. This variable should be used at ends of newspapers only.
the type of contents attached to the request, so of the data are attached (as when a form is sent with method “POST”).
the length of the contents sent by the customer.
Variables coming from the customer
All the variables which are sent by the customer also passed to script
cgi , after the waiter added prefix “HTTP_”. Here some examples of possible variables:
types of data
MIME that the customer agrees to receive.
Example: text/*, image/JPEG, image/png, image/*, */* the languages in which the customer agrees to receive the answer. Example: fr_CA, Fr the navigator used by the customer. Example: Mozilla/5.0 (compatible; Konqueror/3; Linux)
Related articles