Public Member Functions | |
constructor newSession | |
uri ?newUri? | |
rewrite args | |
path | |
param name args | |
params ?newParams? | |
env args | |
method | |
empty | |
host | |
client | |
proto | |
referer | |
agent | |
timestamp | |
Additional Inherited Members |
The HTTP/1.1 request object.
tanzer::request::constructor | newSession | ||
Create a request object attached to the session specified in $newSession
.
tanzer::request::agent |
Returns the value of the User-Agent:
header of the current request, or the string (unknown)
if the header is not present.
tanzer::request::client |
Returns the value of the REMOTE_ADDR
environment variable set for the current request, or -
if no such variable is present.
tanzer::request::empty |
Returns true if no headers are present for the current request.
tanzer::request::env | args | ||
Return all the CGI/1.1 environment variables set for the current request as a list of key-value pairs. If only a name is supplied, then return only the value of that variable, if it exists. If a value is also supplied, then set an environment variable to that value.
tanzer::request::host |
Returns the value of the Host:
header for the current request, or an empty string if one is not present.
tanzer::request::method |
Return the HTTP method verb of the current request, or -
if one was not parsed nor specified previously.
tanzer::request::param | name args | ||
Return the value of the parameter called $name
, or a value is also provided in a second argument, set the value of $name
to that literal value.
tanzer::request::params | ?newParams? | ||
Return a key-value pair list of parameters parsed by a prior call to ::tanzer::request::match. If $newParams
is specified, then replace all current parameters with the values therein.
tanzer::request::path |
Return the URL decoded path component of the URI previously passed to the current request by tanzer::request::uri.
tanzer::request::proto |
Returns the value of the SERVER_PROTOCOL
environment variable set for the current request, or -
if no such variable is present.
tanzer::request::referer |
Returns the value of the Referer:
header of the current request, or -
if that header is not present.
tanzer::request::rewrite | args | ||
Given a list of regular expression and [format]
string pairs, iterate through the list until the first matching regular expression is encountered, and rewrite the URI set in a previous invocation of tanzer::request::uri accordingly. Positional format specifiers in the rewrite format are filled in with values captured from subexpressions in the matching regular expression.
Repeated calls to this method on the same request object yield no effect, and always return 1. Furthermore, subsequent rewrite calls always perform rewrites on the original URI of the request, not the resulting URI from prior rewrite operations.
Example:
tanzer::request::timestamp |
Return the Unix epoch timestamp corresponding to the data in which the current request object was created.
tanzer::request::uri | ?newUri? | ||
Parse the URI passed in $newUri
for the URL-decoded path component, and the query string. These individual components will be parsed and URL decoded as appropriate. $newUri
will be saved literally in the current request for future reference.
If called with a $newUri
value multiple times on the same request object, the new URI will of course take effect, but internally the original URI will be retained; and, when called with no arguments after a new URI was set again, the original URI will always be returned. This is particularly useful in helping the request object remember the original URI for accurate logging purposes.