TWiki::Request
Class to encapsulate request data.
Fields:
action
action requested (view, edit, save, ...)
cookies
hashref whose keys are cookie names and values are CGI::Cookie objects
headers
hashref whose keys are header name
request_method
request method (GET, HEAD, POST)
param
hashref of parameters, both query and body ones
param_list
arrayref with parameter names in received order
path_info
path_info of request (eg. /WebName/TopciName)
remote_address
Client's IP address
remote_user
Remote HTTP authenticated user
secure
Boolean value about use of encryption
server_port
Port that the webserver listens on
uploads
hashref whose keys are parameter name of uploaded files
uri
the request uri
Constructs a TWiki::Request object.
$initializer
- may be a filehandle or hashref. save
method. Note: Restore only parameters
Gets/Sets action requested (view, edit, save, ...)
DEPRECATED. Sets/Gets request method (GET, HEAD, POST). Same as request_method() method.
Sets/Gets request method (GET, HEAD, POST).
Sets/Gets request path info.
Called without parameters returns current pathInfo.
There is a path_info()
alias for compatibility with CGI.
Returns 'https' if secure connection. 'http' otherwise.
Gets/Sets request uri.
Returns query_string part of request uri, if any.
query_string()
alias provided for compatibility with CGI.
Returns many url info.
Reasonably compatible with CGI corresponding method. Doesn't support -rewrite. See Item5914.
Gets/Sets connection's secure flag.
Gets/Sets client IP address.
remote_addr()
alias for compatibility with CGI.
Gets/Sets remote user's name.
remote_user()
alias for compatibility with CGI.
Gets/Sets server user's name.
server_port()
alias for compatibility with CGI.
This methos is used by engines, during its prepare phase. Should not be used anywhere else. Since bodyParam must exist and it has different semantics from param method, this one exists for symmetry, and could be modified in the future, so it could be possible to get query and body parameters independently.
Adds parameters passed within request body. It keeps previous values, but places new ones first. Should be called only by engines. Otherwise use param() method.
Resonably compatible with CGI.
$name
parameter returns value of cookie with that name or undef if it doesn't exist.
ObjectMethod cookies( \%cookies ) -> $hashref
Gets/Sets cookies hashref. Keys are cookie names and values CGI::Cookie objects.
Deletes parameters from request.
Delete()
alias provided for compatibility with CGI
Deletes all parameter name and value(s).
delete_all()
alias provided for compatibility with CGI.
Gets/Sets a header field:
Not compatible with CGI, since CGI correspondent is a
response write method. CGI scripts obtain headers from %ENV
or http
method. %ENV is not available and must be replaced
by calls to this and other methods of this class. http
is
provided for compatibility, but is deprecated. Use this one
instead.
Calls to CGI header
method must be replaced by calls to
TWiki::Response header
method.
Saves object state to filehandle. Object may be loaded latter passing $fh to new constructor or by calling load().
Loads object state from filehandle, probably created with a previous save().
Called with file name parameter returns an open filehandle to uploaded file.
Returns a hashref to information about uploaded files as sent by browser.
Returns the name of temporarly created file to store uploaded $fname.
$fname may be obtained by calling param()
with form field name.
Gets/Sets request uploads field. Keys are uploaded file names, as sent by browser, and values are TWiki::Request::Upload objects.
Called without parameters returns a list of all available header filed names.
Given a field name returns value associated.
http('HTTP_USER_AGENT'); http('User-Agent') and http('User_Agent') are equivalent.
Please, use header()
instead. Present only for compatibility with CGI.
Similar to http()
method above. Called with no parameters returns
secure flag.
Please, use header()
and secure()
instead.
Present only for compatibility with CGI.
Convenience method to get User-Agent string.
user_agent()
alias provided for compatibility with CGI.
Convenience method to get Referer uri.