The reason these variables are called pseudo-environment variables is because the AS/400 doesn't have Unix-style process environment variables. Instead, Web Server/400 simulates this environment and provides an API to access the variable from scripts.
Listed below are all the environment variables set prior to calling a script. Any of these can be accessed by making an API call with the name of the environment variable passed in as one of the parameters.
GATEWAY_INTERFACE
SERVER_NAME
SERVER_PORT
SERVER_SOFTWARE
AUTH_TYPE
auth_type: auth_data. The
auth_type is the same as the AUTH_TYPE environment variable. The
auth_data is the authorization type specific data.
CONTENT_LENGTH
CONTENT_TYPE
PATH_INFO
/cgi-bin/cgitest/extra/path was entered, PATH_INFO
would be set to /extra/path. This value is also completely
unescaped as well. This does not include the query string.
PATH_TRANSLATED
/cgi-bin/cgitest/samples/ is entered, the Default Source
Type is *Root, and the Document Root is /WWWServ/WebDocs/,
then the PATH_TRANSLATED would be set to
. If
/cgi-bin/cgitest/~WWWUSER/ is entered, PATH_TRANSLATED would
be /WWWServ/WWWUser/PubHTML/ (assuming WWWUSER's home
directory is /WWWServ/WWWUser/).
QUERY_STRING
The QUERY_STRING is everything entered after a question mark ("?") in
the URL. This data is not converted at all. The leading question mark is
not included. For example, if the user enters a URL of
/cgi-bin/cgitest?this+is+a+query+string, QUERY_STRING would be
set to this+is+a+query+string.
REMOTE_ADDR
This is the IP address of the browser in dotted decimal notation.
This is always available. For instance, this might be
12.34.56.78.
REMOTE_HOST
This is the host name of the browser making the request. If this
cannot be obtained, it is not set. For example, this might be
joe.company.com.
REMOTE_USER
This is the user name used to authenticate requests to the server. This
is set to the user portion of the Authenticate request header. If this header
is not sent, this variable is not set.
REMOTE_PASSWORD_MD5
This is a hashed version of the password used to authenticate requests
to the server. The password portion of the Authenticate request header is
hashed using the MD5(*) algorithm. This algorithm creates a message digest
of the password. The vital property of this function is that it is very
difficult to obtain the original value (the password) if you only know the
message digest. This means the REMOTE_PASSWORD_MD5 value does not have to be
protected to maintain the integrity of a user's password. If Authenticate the
header is not sent, this variable is not set.
(*)Derived from the RSA Data Security, Inc. MD5
Message-Digest Algorithm.
REQUEST_METHOD
This is the HTTP method of the URL request made by the browser. Some
valid methods are GET, POST, and
PUT.
SCRIPT_NAME
This is the name of the currently running script, as it is known by
browsers. The name is escaped and does not include any of the PATH_INFO or
query strings. For example, the script
/cgi-bin/cgitest/extra/path would have a SCRIPT_NAME of
/cgi-bin/cgitest.
SERVER_PROTOCOL
The SERVER_PROTOCOL is the version of HTTP that is being used for
this request. This can be either HTTP/0.9 or HTTP/1.0.
HTTP/0.9 is only used if the browser has indicated to use that version.
Other Request Headers
All other request headers that are sent by the browser are made
available to the script through environment variables. Each header has a
prefix of HTTP_ added to the header name. Any dashes ("-")
in the header name are changed to underscores ("_"). If the same header
appears more than once, a comma separated list of each of the header's
values is created. For example, the header User-Agent:
NeatBrowser/1.0 would result in an environment variable of
HTTP_USER_AGENT with a value of NeatBrowser/1.0.
Another example is receiving the headers Accept: text/html and
Accept: text/plain. This would result in one environment
variable named HTTP_ACCEPT with a value of text/html,
text/plain.
The additional scripts sample
page shows examples of retrieving environment variables from different
programming languages.