![]() |
Home / Documentation / 2.0 / API / | |||
| Apache::RequestRec - Perl API for Apache request record accessors | ||||
|
|
||
proxyreq
pool
connection
server
next
prev
main
the_request
assbackwards
header_only
protocol
proto_num
hostname
request_time
status_line
status
method
method_number
allowed
allowed_xmethods
allowed_methods
bytes_sent
mtime
remaining
headers_in
headers_out
err_headers_out
notes
handler
content_encoding
content_languages
user
ap_auth_type
no_local_copy
unparsed_uri
uri
filename
canonical_filename
path_info
args
used_path_info
per_dir_config
request_config
output_filters
input_filters
proto_output_filters
proto_input_filters
use Apache::RequestRec ();
sub handler{
my $r = shift;
...
my $auth_type = $r->auth_type;
...
my $s = $r->server;
my $dir_config = $r->dir_config;
}
META: to be completed
proxyreqMETA: Autogenerated - needs to be reviewed/completed
$ret = $r->proxyreq($val);
$r (Apache::RequestRec)
$val (integer)
$ret (integer)
poolMETA: Autogenerated - needs to be reviewed/completed
The pool associated with the request
$p = $r->pool();
$r (Apache::RequestRec)
$p (APR::Pool)
connectionMETA: Autogenerated - needs to be reviewed/completed
The connection record to the client
$c = $r->connection();
$r (Apache::RequestRec)
$c (Apache::Connection)
serverGet the Apache::Server object for
the server the request $r is running under.
$s = $r->server();
$r (Apache::RequestRec)
$s (Apache::Server)
nextMETA: Autogenerated - needs to be reviewed/completed
Pointer to the redirected request if this is an external redirect
$next_r = $r->next();
$r (Apache::RequestRec)
$next_r (Apache::RequestRec)
prevMETA: Autogenerated - needs to be reviewed/completed
Pointer to the previous request if this is an internal redirect
$prev_r = $r->prev();
$r (Apache::RequestRec)
$prev_r (Apache::RequestRec)
mainGet the main request record
$main_r = $r->main();
$r (Apache::RequestRec)
$main_r (Apache::RequestRec)
If the current request is a sub-request, this method returns a blessed reference to the main request structure. If the current request is the main request, then this method returns undef.
To figure out whether you are inside a main request or a
sub-request/internal redirect, use
$r->is_initial_req.
the_requestMETA: Autogenerated - needs to be reviewed/completed
First line of request
$request = $r->the_request();
$r (Apache::RequestRec)
$request (string)
assbackwardsMETA: Autogenerated - needs to be reviewed/completed
HTTP/0.9, "simple" request (e.g. GET /foo\n w/no headers)
$status = $r->assbackwards($newval);
$r (Apache::RequestRec)
$newval (integer)
$status (integer)
header_onlyMETA: Autogenerated - needs to be reviewed/completed
HEAD request, as opposed to GET
$status = $r->header_only();
$r (Apache::RequestRec)
$status (integer)
protocolMETA: Autogenerated - needs to be reviewed/completed
Protocol string, as given to us, or HTTP/0.9
$protocol = $r->protocol();
$r (Apache::RequestRec)
$protocl (string)
proto_numMETA: Autogenerated - needs to be reviewed/completed
Protocol version number of protocol; 1.1 = 1001
$proto_num = $r->proto_num();
$r (Apache::RequestRec)
$proto_num (integer)
hostnameMETA: Autogenerated - needs to be reviewed/completed
Host, as set by full URI or Host:
$hostname = $r->hostname();
$r (Apache::RequestRec)
$hostname (string)
request_timeMETA: Autogenerated - needs to be reviewed/completed
Time when the request started
$request_time = $r->request_time();
$r (Apache::RequestRec)
$request_time (number)
status_lineMETA: Autogenerated - needs to be reviewed/completed
Status line, if set by script
$status_line = $r->status_line();
$r (Apache::RequestRec)
$status_line (string)
statusMETA: Autogenerated - needs to be reviewed/completed
Get/set status line
$status = $r->status($new_status); $status = $r->status();
$r (Apache::RequestRec)
$new_status (integer)
If $new_status is passed the new status is assigned.
$newval (integer)
If $new_status is passed the old status is returned.
methodMETA: Autogenerated - needs to be reviewed/completed
Request method (eg. GET, HEAD, POST, etc.)
$method = $r->method();
$r (Apache::RequestRec)
$method (string)
method_numberMETA: Autogenerated - needs to be reviewed/completed
Apache::M_GET, Apache::M_POST, etc.
$methno = $r->method_number();
$r (Apache::RequestRec)
$methno (integer)
allowedMETA: Autogenerated - needs to be reviewed/completed
'allowed' is a bitvector of the allowed methods.
$allowed = $r->allowed();
$r (Apache::RequestRec)
$allowed (number)
A handler must ensure that the request method is one that it is capable of handling. Generally modules should DECLINE any request methods they do not handle. Prior to aborting the handler like this the handler should set r->allowed to the list of methods that it is willing to handle. This bitvector is used to construct the "Allow:" header required for OPTIONS requests, and HTTP_METHOD_NOT_ALLOWED and HTTP_NOT_IMPLEMENTED status codes.
Since the default_handler deals with OPTIONS, all modules can usually decline to deal with OPTIONS. TRACE is always allowed, modules don't need to set it explicitly.
Since the default_handler will always handle a GET, a module which does *not* implement GET should probably return HTTP_METHOD_NOT_ALLOWED. Unfortunately this means that a Script GET handler can't be installed by mod_actions.
allowed_xmethodsMETA: Autogenerated - needs to be reviewed/completed
Array of extension methods
$array = $r->allowed_xmethods();
$r (Apache::RequestRec)
$array (APR::ArrayHeader)
allowed_methodsMETA: Autogenerated - needs to be reviewed/completed
List of allowed methods
$list = $r->allowed_methods();
$r (Apache::RequestRec)
$list (Apache::MethodList)
bytes_sentMETA: Autogenerated - needs to be reviewed/completed
body byte count, for easy access
$bytes_sent = $r->bytes_sent();
$r (Apache::RequestRec)
$bytes_sent (integer)
mtimeMETA: Autogenerated - needs to be reviewed/completed
Last modified time of the requested resource
$mtime = $r->mtime($new_mtime); $mtime = $r->mtime();
$r (Apache::RequestRec)
$new_mtime (number)
$mtime (number)
remainingMETA: Autogenerated - needs to be reviewed/completed
Remaining bytes left to read from the request body
$bytes = $r->remaining();
META: I think this method is not needed if the deprecated client_block methods aren't used, (and plain $r-<read() is used instead).
$r (Apache::RequestRec)
$bytes (integer)
headers_inMETA: Autogenerated - needs to be reviewed/completed
$headers_in = $r->headers_in();
$r (Apache::RequestRec)
$headers_in (APR::Table)
headers_outMETA: Autogenerated - needs to be reviewed/completed
MIME header environment for the response
$headers_out = $r->headers_out();
$r (Apache::RequestRec)
$headers_out (APR::Table)
err_headers_outMETA: Autogenerated - needs to be reviewed/completed
MIME header environment for the response, printed even on errors and persist across internal redirects
$err_headers_out = $r->err_headers_out();
$r (Apache::RequestRec)
$err_headers_out (APR::Table)
The difference between headers_out and err_headers_out is that the latter are printed even on error, and persist across internal redirects (so the headers printed for ErrorDocument handlers will have them).
notesMETA: Autogenerated - needs to be reviewed/completed
Notes from one module to another
$notes = $r->notes(); $notes = $r->notes($new_notes);
$r (Apache::RequestRec)
$new_notes (APR::Table)
$notes (APR::Table)
The 'notes' is for notes from one module to another, with no other set purpose in mind...
handlerMETA: Autogenerated - needs to be reviewed/completed
$handler = $r->handler(); $handler = $r->handler($new_handler);
$r (Apache::RequestRec)
$new_handler (string)
$handler (string)
content_encodingMETA: Autogenerated - needs to be reviewed/completed
$ce = $r->content_encoding();
$r (Apache::RequestRec)
$ce (string)
content_languagesMETA: Autogenerated - needs to be reviewed/completed
Array of strings representing the content languages
$array_header = $r->content_languages();
$r (Apache::RequestRec)
$array_header (APR::ArrayHeader)
userMETA: Autogenerated - needs to be reviewed/completed
If an authentication check was made, this gets set to the user name.
$r->user($user); $user = $r->user();
$r (Apache::RequestRec)
$user (string)
$user (string)
ap_auth_typeIf an authentication check was made, get or set the ap_auth_type slot in the request record
$auth_type = $r->ap_auth_type(); $r->ap_auth_type($newval);
$r (Apache::RequestRec)
$newval (string)
If this argument is passed then a new auth type is assigned. For example:
$r->auth_type('Basic');
$auth_type (string)
If $newval is passed, nothing is returned. Otherwise the current
auth type is returned.
ap_auth_type holds the authentication type that has been negotiated
between the client and server during the actual request. Generally,
ap_auth_type is populated automatically when you call
$r->get_basic_auth_pw so you don't really need to worry too
much about it, but if you want to roll your own authentication
mechanism then you will have to populate ap_auth_type yourself.
Note that $r->ap_auth_type was
$r->connection->auth_type in the mod_perl 1.0 API.
no_local_copyMETA: Autogenerated - needs to be reviewed/completed
There is no local copy of this response
$status = $r->no_local_copy();
$r (Apache::RequestRec)
$status (integer)
unparsed_uriMETA: Autogenerated - needs to be reviewed/completed
The URI without any parsing performed
$unparsed_uri = $r->unparsed_uri();
$r (Apache::RequestRec)
$unparsed_uri (string)
uriMETA: Autogenerated - needs to be reviewed/completed
The path portion of the URI
$uri = $r->uri(); $r->uri($uri);
$r (Apache::RequestRec)
$uri (string)
$uri (string)
filenameMETA: Autogenerated - needs to be reviewed/completed
The filename on disk corresponding to this response
$filename = $r->filename(); $r->filename($filename);
$r (Apache::RequestRec)
$filename (string)
$filename (string)
canonical_filenameMETA: Autogenerated - needs to be reviewed/completed
$canon_filename = $r->canonical_filename();
$r (Apache::RequestRec)
$canon_filename (string)
path_infoMETA: Autogenerated - needs to be reviewed/completed
The PATH_INFO extracted from this request
$path_info = $r->path_info(); $r->path_info($path_info);
$r (Apache::RequestRec)
$path_info (string)
$path_info (string)
argsMETA: Autogenerated - needs to be reviewed/completed
The QUERY_ARGS extracted from this request
$args = $r->args(); $r->args($args);
$r (Apache::RequestRec)
$args (string)
$args (string)
used_path_infoMETA: Autogenerated - needs to be reviewed/completed
Flag for the handler to accept or reject path_info on the current request. All modules should respect the AP_REQ_ACCEPT_PATH_INFO and AP_REQ_REJECT_PATH_INFO values, while AP_REQ_DEFAULT_PATH_INFO indicates they may follow existing conventions. This is set to the user's preference upon HOOK_VERY_FIRST of the fixups.
$ret = $r->used_path_info($newval);
$r (Apache::RequestRec)
$newval (integer)
per_dir_configMETA: Autogenerated - needs to be reviewed/completed
These are config vectors, with one void* pointer for each module (the thing pointed to being the module's business). * Options set in config files, etc.
$per_dir_config = $r->per_dir_config();
$r (Apache::RequestRec)
$per_dir_config (Apache::ConfVector)
request_configMETA: Autogenerated - needs to be reviewed/completed
Notes on *this* request
$ret = $r->request_config($newval);
$r (Apache::RequestRec)
$newval (Apache::ConfVector)
output_filtersMETA: Autogenerated - needs to be reviewed/completed
A list of output filters to be used for this request
$output_filters = $r->output_filters();
$r (Apache::RequestRec)
$output_filters (Apache::Filter)
input_filtersMETA: Autogenerated - needs to be reviewed/completed
A list of input filters to be used for this request
$input_filters = $r->input_filters();
$r (Apache::RequestRec)
$input_filters (Apache::Filter)
proto_output_filtersMETA: Autogenerated - needs to be reviewed/completed
A list of protocol level output filters to be used for this request
$proto_output_filters = $r->proto_output_filters();
$r (Apache::RequestRec)
$proto_output_filters (Apache::Filter)
proto_input_filtersMETA: Autogenerated - needs to be reviewed/completed
A list of protocol level input filters to be used for this request
$proto_input_filters = $r->proto_input_filters();
$r (Apache::RequestRec)
$proto_input_filters (Apache::Filter)
mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 1.1.
|
|