Oracle iPlanet Web Server 7.0.9 Administrator's Configuration File Reference

Variables

The Web Server includes a set of variables predefined by the server, as well as the capability for you to define custom variables. This section includes the following sections:

Predefined Variables

Predefined variables are implicitly defined by the server. The following table lists the predefined variables and their descriptions:

Table A–1 Predefined Variables

Variable 

Description 

$n

Regular expression backreference (value of the nth capturing subpattern, n = 1...9), for example, $1.

Regular expression backreferences are only available within the body of If and ElseIf containers, and only if the container expressions includes one or more regular expressions. For more information on If and ElseIf, see If, ElseIf, and Else.

$&

Value that matched a regular expression. 

Regular expression backreferences are only available within the body of If and ElseIf containers, and only if the container expressions includes one or more regular expressions. For more information on If and ElseIf, see If, ElseIf, and Else.

$auth_group

Authenticated user's group (alias for $vars{'auth-group'}).

$auth_type

Authentication method (alias for $vars{'auth-type'}).

$auth_user

Authenticated user name (alias for $vars{'auth-user'}).

$browser

Web browser version (alias for $headers{'user-agent'} if the client sent a User-Agent header or an empty string).

$chunked

Boolean variable that indicates whether request body was sent using chunked encoding. 

$code

Response status code. 

$cookie{'name'}

Value of the cookie name from request.

$dns

Alias for $client{'dns'}.

$env{'name'}

Value of the environment variable name (includes CGI/SHTML environment variables).

$headers{'name'}

Value of name from rq->headers, that is, value of the request header name where name is a lowercase string.

$id

Virtual server ID as specified by the name subelement of the virtual-server element in server.xml. For more information, see virtual-server.

$internal

Boolean that indicates whether request was internally generated. 

$ip

Alias for $client{'ip'}.

$keep_alive

Boolean that indicates whether the connection will be kept open. 

$keysize

Alias for $client{'keysize'}.

$method

Request method (alias for $reqpb{'method'}).

$path

Requested path (either URI, partial path, or file system path depending on stage). 

The predefined variable path is the value of path from rq->vars. If path isn't set in rq->vars (for example, if NameTrans hasn't completed), path gets the value of ppath from rq->vars.

$path_info

Alias for $vars{'path-info'}.

$ppath

Alias for $vars{'ppath'}.

$protocol

Request protocol (alias for $reqpb{'protocol'}).

$query

Request query string (alias for $reqpb{'query'}).

$reason

Response reason phrase. 

$referer

Alias for $headers{'referer'}.

$reqpb{'name'}

Value of name from rq->reqpb.

$restarted

Boolean that indicates whether request has been restarted. 

$secret_keysize

Alias for $client{'secret-keysize'}.

$server_url

Prefix for self-referencing URLs. 

$time

Time the request was received as the number of seconds since 00:00:00 UTC, January 1, 2006. 

$time_day

Day of the month when the request was received. Value can be from 01 to 31. 

$time_hour

Hours since midnight when the request was received. Value can be from 00 to 23. 

$time_min

Minutes after the hour when the request was received. Value can be from 00 to 59. 

$time_mon

Month of the year when the request was received. Value can be from 01 to 12. 

$time_sec

Seconds after the minute when the request was received. Value can be from 00 to 61. 

$time_wday

Day of the week when the request was received. Value can be from 0 to 6, where 0 corresponds to Sunday. 

$time_year

Four-digit year when the request was received. 

$type

Alias for $srvhdrs{'content-type'}.

$uri

URI of the requested resource (alias for $reqpb{'uri'}).

$url

URL of the requested resource. 

$urlhost

Host name to which the client connected. 

$vars{'$headers{'name'}

Value of name from rq->vars.

$security

Boolean that indicates whether a secure transport was used. 

$senthdrs

Boolean that indicates whether response headers have been sent. 

$srvhdrs{'$headers{'name'}

Value of name from rq->srvhdrs, that is, value of response header name where name is a lowercase string.

Custom Variables

You can define custom variables in the server.xml file using the variables element. These variables can then be used in function parameters in obj.conf functions. You can also define variables at request time using the set-variables function in obj.conf.

For more information, see variable and set-variable.


Note –

Because predefined variables take precedence over custom variables, it is a best practice to use uppercase names for custom variables. Using uppercase avoids conflicts with the lowercase predefined variables, should the list of predefined variables be extended in the future.


Resolving Variables

    The server uses the following order when attempting to resolve a $variable:

  1. Predefined variables

  2. Variables defined at request time using set-variable in obj.conf

  3. Variables defined by the virtual-server element's variable subelement in server.xml

  4. Variables defined by the server element's variable subelement in server.xml

When you define a $variable at request time, it is stored as a name-value pair in the rq->vars pblock. These variables are given a higher precedence than server.xml variables so that server.xml variables can be overridden at request time.