Contents SAS/IntrNet 8.2: Application Dispatcher Previous Next

Exporting Environment Variables

The following table from the sample configuration file lists some standard CGI environment variables. However, you can pass any variables that your Web server supports. (For more information about environment variables, see the CGI area at the World Wide Web Consortium Web site.)

Note: These SAS macro variable names are suggestions only; you do not need to use these exact names.

Environment variables SAS macro variable Description
GATEWAY_INTERFACE _GATEWAY Version of the Common Gateway Interface (CGI) that the Web server uses.
SERVER_NAME _SRVNAME Web server's DNS (host) name or IP address.
SERVER_SOFTWARE _SRVSOFT Web server software name and version.
SERVER_PROTOCOL _SRVPROT Name and revision of the HTTP information protocol transmitting the client request.
SERVER_PORT _SRVPORT Web server port number.
REQUEST_METHOD _REQMETH Method with which the information request was issued, for example, GET or POST. This corresponds with the <FORM...METHOD=GET|POST> statement in the HTML form.
PATH_INFO _PATHINF Extra path information after the script passed to a CGI program.
SCRIPT_NAME _SCRIPT Virtual path of the script being executed. In this case, a duplicate of _URL, another macro variable passed to the Dispatcher program.
DOCUMENT_ROOT _DOCROOT Directory from which Web documents are served. This variable is unreliable.
QUERY_STRING _QRYSTR Query information passed to the program. It is appended to the URL with a question mark (?). In this case, it is an unparsed version of the user macro parameters. Set only with GET.
REMOTE_HOST _RMTHOST User's DNS (remote host) name, if known.
AUTH_TYPE _AUTHTYP Authentication method used to validate a user, usually Basic.
REMOTE_USER _RMTUSER Username, if authenticated.
REMOTE_IDENT _RMTID Identification of user making request. RFC931 ID, if supported.
CONTENT_TYPE _CONTTYP The Internet media type (MIME type) of the query data. Set only with POST.
CONTENT_LENGTH _CONTLEN Length of the data (in bytes or number of characters) passed to the CGI program. Set only with POST.
HTTP_FROM _HTFROM E-mail address of the user making the request (unreliable).
HTTP_ACCEPT _HTACPT Internet media (MIME) types that the client can accept. However, you may find using the HTTP_USER_AGENT variable more reliable than HTTP_ACCEPT.
HTTP_COOKIE _HTCOOK Cookies. See also the Set-Cookie header line.
HTTP_REFERER _HTREFER If known, the URL of the document that the client points to before accessing the CGI program.

The Web server makes essential information available to CGI programs as environment variables. You can pass some or all of this information on to your Dispatcher programs by using the Export directive. The syntax is

   Export <environment-variable> <SAS variable name>

The Export directive instructs the Broker to retrieve the contents of the specified environment variable and make it available to Dispatcher programs in the specified SAS macro variable or SCL list item.

The sample configuration file includes several Export directives. You can activate a directive by changing the information to match your site and removing the # that appears at the left of the export line.

Some Export directives are activated by default. Export REMOTE_HOST _RMTHOST is one. These directives are not preceded by a # in the default configuration file.

If you omit the SAS name, the name of the environment variable will be used as the SAS macro name.

If the value of the environment variable is greater than your field width (as set in _FLDWDTH), then the variable divides like any field into multiple variables. You can avoid this by using SAS variable names with a leading underscore, such as _RMTHOST. Dispatcher variables that begin with an underscore are not divided according to _FLDWDTH. These variables are truncated at 32767 characters.

Contents SAS/IntrNet 8.2: Application Dispatcher Previous Next