|
On This Page |
Common Environment Variables Available to XSSIs |
|
|
- Environment Variables available to XSSI commands
- The page below lists many of the environment variables that are usually generated by an http request. These variables vary greatly between platforms, servers and server versions. If you know of more, please let me know so I can add them. All of the following variables can be referenced in XSSI commands.
- This chart is in order by Function. Another one is available in an Alphabetical listing.
Information about the Browser (client)
- HTTP_ACCEPT
- The MIME types which the client will accept, as given by HTTP headers ("Accept:"). Other protocols may need to get this information from elsewhere. Each item in this list should be separated by commas as per the HTTP spec.
Format: type/subtype, type/subtype
Example: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*
- HTTP_ACCEPT_CHARSET
- Contains the contents of any "Accept-Charset:" headers supplied by the client.
Example: iso-8859-1,*,utf-8
- HTTP_ACCEPT_LANGUAGE
- Contains the contents of any "Accept-Language:" headers supplied by the client.
Example: en
- HTTP_CONNECTION
- Usually set to 'Keep-Alive' by browsers that support sending more than one file in a single client/server connection.
Example: Keep-Alive
- HTTP_COOKIE
- Contains the contents of any "Cookie:" header supplied by the client.
- HTTP_FROM
- The e-mail address of the user making the request. Most browsers do not support this variable. This variable is often user-definable on the browser side and my not reflect reality.
- HTTP_HOST
- Contains the contents of the "Host:" header supplied by the client. This should contain the one of the aliases for the host on which the server is running. It should be the hostname from the URL that the client is requesting. Thus a client seeking http://www.serverhost.com:8000/foo.html should supply "www.serverhost.com" in this header. Many browsers do not do this. It is required in HTTP/1.1.
Example: www.powertalk.com
- HTTP_REFERER
- The URL of the document that the client displayed which linked to the address of the current request. Contains the contents of the "Referer:" header from the client.
Example: http://www.powertalk.com/rosso/cgi-bin/printenv.cgi?huh
- HTTP_USER_AGENT
- Contains the contents of the "User-Agent:" header supplied by the client. This is supposed to contain the name of the browser which the client is using to make this request.
Example: Mozilla/3.0 (Macintosh; I; PPC)
- PATH_INFO
- The extra path information, as given by the client. In other words, scripts can be accessed by their virtual pathname, followed by extra information at the end of this path. The extra information is sent as PATH_INFO. This information should be decoded by the server if it comes from a URL before it is passed to the CGI script.
- REMOTE_ADDR
- The IP address of the remote host (client or proxy) making the request.
Example: 198.105.63.8
- REMOTE_HOST
- The hostname making the request. If the server does not have this information, it should be set equivilent to REMOTE_ADDR.
Example: ppp-61-7.majorisp.net
- REMOTE_IDENT
- If the HTTP server supports RFC 931 identification, then this variable will be set to the remote user name retrieved from the server. Usage of this variable should be limited to logging only.
- REMOTE_PORT
- This variable will be set to the port number that created the request on the client.
Example: 1634
- REMOTE_USER
- If the server supports user authentication, and the script is protected, this is the username they have authenticated as.
Information about the Time and Date
- DATE_GMT
- The current date in Greenwich Mean Time.
- DATE_LOCAL
- The current date in the local time zone.
Information about the Server (Host)
- AUTH_TYPE
- If the server supports user authentication, and the script is protected, this is the protocol-specific authentication method used to validate the user.
Example: "Basic" or "Digest"
- DOCUMENT_ROOT
- The directory from which Web documents are served.
Example: /disk3/powertalk/users/rosso/public_html
- GATEWAY_INTERFACE
- The revision of the CGI specification to which this server complies.
Format: CGI/revision
Example: CGI/1.1
- SERVER_ADMIN
- The e-mail address of server's administrator.
Example: webmaster@bad-seed.org
- SERVER_NAME
- The server's hostname, DNS alias, or IP address as it would appear in self-referencing URLs.
Example: www.powertalk.com
- SERVER_PORT
- The port number to which the request was sent. Most often '80'
Example: 80
- SERVER_PROTOCOL
- The name and revision of the information protcol this request came in with.
Format: protocol/revision
Example: HTTP/1.0
- SERVER_SOFTWARE
- The name and version of the information server software answering the request (and running the gateway).
Format: name/version
Example: Apache/1.3.3 (Unix) (Red Hat/Linux)
Information about the Document (Requested URL or File)
- CONTENT_LENGTH
- The length of the content as given by the client for a POST. The length is an ASCII string representing the number of bytes.
- CONTENT_TYPE
- For queries which have attached information, such as HTTP POST and PUT, this is the content type of the data.
- DOCUMENT_NAME
- The filename (excluding directories) of the document requested by the user.
- DOCUMENT_URI
- The (%-decoded) URL path of the document requested by the user. Note that in the case of nested include files, this is not the URL for the current document!
- LAST_MODIFIED
- The last modification date of the document requested by the user.
- PATH
- Example: /bin:/usr/bin:/usr/etc:/usr/ucb
- PATH_TRANSLATED
- The server provides a translated version of PATH_INFO, which takes the path and does any virtual-to-physical mapping to it.
- QUERY_STRING
- The information which follows the ? in the URL which referenced this script. This is the query information. It should not be decoded in any fashion. This variable should always be set when there is query information, regardless of command line decoding.
Example: search=name+find=smith
- REQUEST_METHOD
- The method with which the request was made. For HTTP, this is "GET", "HEAD", "POST", etc.
Example: POST
- REQUEST_URI
- The virtual path of the document requested. This is the directory and filename request that comes after the domain name in a URL.
Example: /rosso/xssi/background/environmentvars.shtml
- SCRIPT_FILENAME
- A physical path to the script being executed.
Example: /export/home/rosso/public_html/cgi-bin/printenv.cgi
- SCRIPT_NAME
- A virtual path to the script being executed, often used for self-referencing URLs.
Example: /rosso/cgi-bin/printenv.cgi
|