function
Library: CGI programming support (OMCGI)
Include: omcgi.xin |
define function cgiGetEnv into write-only string env-shelf
Argument definitions
The cgiGetEnv function retrieves the values of all CGI-related environment variables. The function places those values on a keyed string shelf of name/value pairs, where the key of the item is the name of the environment variable and the item's value is the value of that variable. Declare the shelf you want the variables placed on as variable
. Note that the function always clears the shelf before placing values on it. For example:
declare #process-input has unbuffered declare #process-output has binary-mode include "omcgi.xin" process local string env-vars variable cgiGetEnv into env-vars
The cgiGetEnv function retrieves the following list of CGI-related environment variables. Note that not all web servers will set all of these variable values in all situations. If the web server doesn't set the value of a variable, its value is a zero-length string.
AUTH_TYPE
: The authentication protocol currently being used. This variable is defined only if the server supports, and if access to the CGI program requires, authentication.
CONTENT_LENGTH
: The length, in bytes, of the information the web server sends to the CGI program as input. This variable is used most often when the CGI program will be processing input sent from an HTML form using the "POST" method.
CONTENT_TYPE
: The type of content the web server sends to the CGI program as input.
DOCUMENT_ROOT
: This variable is set to the value of the DocumentRoot directive of the accessed website.
GATEWAY_INTERFACE
: The version of the Common Gateway Interface that the web server supports.
HTTP_ACCEPT
: A comma-separated list of MIME types that the browser software accepts.
HTTP_ACCEPT_CHARSET
: The character set that the client accepts.
HTTP_ACCEPT_LANGUAGE
: The language that the client accepts.
HTTP_CONNECTION
: The type of connection that the client and server use. For example, HTTP_CONNECTION = Keep-Alive
.
HTTP_COOKIE
: The list of cookies defined for that URI (in other words, the contents of cookies sent with the page).
HTTP_HOST
: The IP address or host name of the accessed machine.
HTTP_REFERER
: The URI that forwarded the request to the called CGI program.
HTTP_USER_AGENT
: The browser software and operating system that the client system is running.
PATH_INFO
: Extra path information from the request.
PATH_TRANSLATED
: Maps the CGI program's virtual path (from the root of the server directory, for example) to a physical path that could be used to call the program.
QUERY_STRING
: Contains the encoded data from a form submission when that form is submitted using the "GET" method. If a form is submitted using the "POST" method, this environment variable is not set, as the encoded data is passed to the CGI program through standard input (in OmniMark terms, through #process-input
).
REMOTE_ADDR
: The IP address of the client machine.
REMOTE_HOST
: The host name of the client machine.
REMOTE_IDENT
: Stores the user identification information that the remote identd (identification daemon) returns. Few systems run this type of daemon process, however, so this environment variable is rarely set.
REMOTE_PORT
: The port number the client uses to originate the connection to request the CGI program.
REMOTE_USER
: The authenticated user ID of the user requesting the CGI program. This variable is defined only if the server supports, and if access to the program requires, authentication.
REQUEST_METHOD
: The method used to call the CGI program (usually "GET" or "POST").
REQUEST_URI
: The URI of the request.
SCRIPT_FILENAME
: The URI of the requested CGI program.
SCRIPT_NAME
: The virtual path to the program.
SERVER_ADMIN
: The value of the ServerAdmin directive, if one is used, to set the email address of the web server in the web server's configuration file.
SERVER_NAME
: The configured host name for the server (usually www.something.com).
SERVER_PORT
: The port number on which the server software is listening for requests (usually 80, the default web server port).
SERVER_PROTOCOL
: The web protocol version that the server uses (for example, HTTP 1.0).
SERVER_SOFTWARE
: The web server software and version number.