Click Here!
home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

HTML 4.0 Sourcebook
(Publisher: John Wiley & Sons, Inc.)
Author(s): Ian S. Graham
ISBN: 0471257249
Publication Date: 04/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next



Table 10.2 Environment Variables Available Within a Gateway Program
(A) Server Properties
SERVER_SOFTWARE The name and version of the server software answering the request, in the format name/version: for example, NCSA/1.5.2 or Apache/1.1.1.
SERVER_NAME The Internet domain name of the server; if the domain name is not known, this is the numerical IP address.
GATEWAY_INTERFACE The version of the CGI specification used by the server in the format CGI/ version. The current version is 1.1, so this should be CGI/1.1.
SERVER_PROTOCOL The protocol being used and the version number, in the format protocol/version. This permits gateway programs that support different protocols (e.g., Gopher and HTTP) or different protocol versions, as the program can use this variable to select appropriate code sections. The current HTTP protocol version is 1.0, so this is usually HTTP/1.0.
SERVER_PORT The port number used in a transaction (typically 80).
(B) Client Properties
REMOTE_HOST The Internet domain name of the host making the request. If the domain name is unavailable, this variable is undefined. The numerical IP address is always available in the REMOTE_ADDR variable.
REMOTE_ADDR The numeric IP address of the remote host accessing the server. This is always defined.
HTTP_ NAME The contents of all the request header fields sent by the client. The environment variable name is composed of the string HTTP_ NAME, where NAME is capitalized header field name, with all dashes in the name converted to underscores: for example, HTTP_USER_AGENT for the User-Agent field.
(C) Request Properties
REQUEST_METHOD The method associated with the request. For HTTP server access this will be GET, HEAD, POST, PUT, and so on.
PATH_INFO Extra path information present in the URL; undefined if there is no such information in the URL.
PATH_TRANSLATED The PATH_INFO path translated into an absolute path on the server’s filesystem; undefined if PATH_INFO is undefined. For example, if the server document directory is /vast/igraham/WebDocs, and PATH_INFO=dir/file, then PATH_TRANSLATED=/vast/igraham/WebDocs/dir/file This is often used to reference gateway program configuration files. Note that this is not related to the location of the gateway program.
SCRIPT_NAME The path and name of the script being accessed as it would be referenced in a URL: for example, /cgi-bin/prog.pl. This can be used to construct URLs that refer back to this same gateway program, for insertion in script-generated HTML documents. For example, the string http://$SERVER_NAME:$SERVER_PORT$SCRIPT_NAME generates the full URL to the program using information contained in the environment variables ($NAME refers to the content of the environment variable NAME).
QUERY_STRING The query string portion of the URL, in encoded form. A gateway program must decode this string to extract the data sent by the client. If this string results from an ISINDEX search request, the query string data are also passed to the program as decoded command-line arguments.
(D) Authentication Information
AUTH_TYPE The authentication method required to authenticate the user requesting access. This is defined only for scripts that are access protected. The only currently implemented value is Basic, for the Basic authentication scheme.
REMOTE_USER The authenticated name of the user; defined only when authentication is required. This is undefined if authentication is not required.
REMOTE_IDENT The remote user name, retrieved by the server from the client machine using the identd protocol and the remote identification daemon. This is largely unused.
(E) Client Data Properties
CONTENT_TYPE The MIME content-type of the data sent by the client to the server (POST or PUT method). This is undefined if no data are sent. The actual data are available to the gateway program by reading from standard input. The currently implemented types for POST requests are application/x-www-form-urlencoded and application/form-data.
CONTENT_LENGTH The length, in bytes, of the data message sent to the server by the client (POST or PUT methods). If no data are being sent, this is undefined. A gateway program does not have to read all the data before returning a response or before exiting.


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.