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

  • SERVER_SOFTWARE
the name and the version of the Waiter HTTP answering the request. (Format: name/version)
  • SERVER_NAME
the Host name, alias DNS or Address IP of the waiter.
  • GATEWAY_INTERFACE
the revision of the specification cgi which the waiter uses. (Format: CGI/révision)

Variables specific to the request

  • SERVER_PROTOCOL
the name and the revision of the protocol in which the request was made (Format: protocol/revision)
  • SERVER_PORT
the number of port on which the request was sent.
  • REQUEST_METHOD
method used to make the request. For HTTP, it generally contains “GET” or “POST”.
  • PATH_INFO
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”.
  • PATH_TRANSLATED
Contient the way requested by the customer after conversions virtual → physical were made by the waiter.
  • SCRIPT_NAME
the virtual way towards script being carried out. Example: “/cgi-bin/script.cgi”
  • QUERY_STRING
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&… ”.
  • REMOTE_HOST
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.
  • REMOTE_ADDR
the Address IP of the customer.
  • AUTH_TYPE
the type of identification used to protect script (if it is protected and if the waiter supports the identification).
  • REMOTE_USER
the name of user of the customer, if script is protected and if the waiter supports the identification.
  • REMOTE_IDENT
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.
  • CONTENT_TYPE
the type of contents attached to the request, so of the data are attached (as when a form is sent with method “POST”).
  • CONTENT_LENGTH
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:
  • HTTP_ACCEPT
types of data MIME that the customer agrees to receive.
Example: text/*, image/JPEG, image/png, image/*, */*
  • HTTP_ACCEPT_LANGUAGE
the languages in which the customer agrees to receive the answer.
Example: fr_CA, Fr
  • HTTP_USER_AGENT
the navigator used by the customer.
Example: Mozilla/5.0 (compatible; Konqueror/3; Linux)

Related articles

Random links:Saint-Lambert-of-Lauzon | Lucelle (Haut-Rhin) | Johannes Blaeu | Walloon movement | Margo Lion