📄 apache2::requestrec.3
字号:
.IX Item "ret: $notes ( APR::Table object )".PDthe current notes table..Spif the \f(CW$new_notes\fR argument was passed, returns the previous value..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPIf you want to pass Perl structures, you can use\&\f(CW\*(C`$r\->pnotes\*(C'\fR..PPAlso see\&\f(CW\*(C`$c\->notes\*(C'\fR.ie n .Sh """output_filters""".el .Sh "\f(CWoutput_filters\fP".IX Subsection "output_filters"Get the first filter in a linked list of request level output filters:.PP.Vb 2\& $output_filters = $r\->output_filters();\& $prev_output_filters = $r\->output_filters($new_output_filters);.Ve.ie n .IP "obj: $r\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "obj: $r ( Apache2::RequestRec object )".PD 0.ie n .IP "opt arg1: $new_output_filters" 4.el .IP "opt arg1: \f(CW$new_output_filters\fR" 4.IX Item "opt arg1: $new_output_filters".PDSet a new value.ie n .IP "ret: $output_filters\fR ( \f(CW""Apache2::Filter object"" )" 4.el .IP "ret: \f(CW$output_filters\fR ( \f(CWApache2::Filter object\fR )" 4.IX Item "ret: $output_filters ( Apache2::Filter object )"The first filter in the request level output filters chain..SpIf \f(CW$new_output_filters\fR was passed, returns the previous value..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPFor example instead of using\&\f(CW\*(C`$r\->print()\*(C'\fR tosend the response body, one could send the data directly to the firstoutput filter. The following function \f(CW\*(C`send_response_body()\*(C'\fR doesjust that:.PP.Vb 3\& use APR::Brigade ();\& use APR::Bucket ();\& use Apache2::Filter ();\& \& sub send_response_body {\& my ($r, $data) = @_;\& \& my $bb = APR::Brigade\->new($r\->pool,\& $r\->connection\->bucket_alloc);\& \& my $b = APR::Bucket\->new($bb\->bucket_alloc, $data);\& $bb\->insert_tail($b);\& $r\->output_filters\->fflush($bb);\& $bb\->destroy;\& }.Ve.PPIn fact that's what\&\f(CW\*(C`$r\->read()\*(C'\fR doesbehind the scenes. But it also knows to parse \s-1HTTP\s0 headers passedtogether with the data and it also implements buffering, which theabove function does not..ie n .Sh """path_info""".el .Sh "\f(CWpath_info\fP".IX Subsection "path_info"Get/set the \f(CW\*(C`PATH_INFO\*(C'\fR, what is left in the path after the \fI\s-1URI\s0\&\-\-> filename\fR translation:.PP.Vb 2\& $path_info = $r\->path_info();\& $prev_path_info = $r\->path_info($path_info);.Ve.ie n .IP "obj: $r\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "obj: $r ( Apache2::RequestRec object )".PD 0.ie n .IP "opt arg1: $path_info ( string )" 4.el .IP "opt arg1: \f(CW$path_info\fR ( string )" 4.IX Item "opt arg1: $path_info ( string )".PDSet a new value.ie n .IP "ret: $path_info ( string )" 4.el .IP "ret: \f(CW$path_info\fR ( string )" 4.IX Item "ret: $path_info ( string )"Return the current value..SpIf the optional argument \f(CW$path_info\fR is passed, the previous valueis returned..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".ie n .Sh """per_dir_config""".el .Sh "\f(CWper_dir_config\fP".IX Subsection "per_dir_config"Get the dir config vector:.PP.Vb 1\& $per_dir_config = $r\->per_dir_config();.Ve.ie n .IP "obj: $r\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "obj: $r ( Apache2::RequestRec object )".PD 0.ie n .IP "ret: $per_dir_config\fR ( \f(CW""Apache2::ConfVector object"" )" 4.el .IP "ret: \f(CW$per_dir_config\fR ( \f(CWApache2::ConfVector object\fR )" 4.IX Item "ret: $per_dir_config ( Apache2::ConfVector object )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PPFor an indepth discussion, refer to the Apache Server ConfigurationCustomization in Perl chapter..ie n .Sh """pool""".el .Sh "\f(CWpool\fP".IX Subsection "pool"The pool associated with the request.PP.Vb 1\& $p = $r\->pool();.Ve.ie n .IP "obj: $r\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "obj: $r ( Apache2::RequestRec object )".PD 0.ie n .IP "ret: $p\fR ( \f(CW""APR::Pool object"" )" 4.el .IP "ret: \f(CW$p\fR ( \f(CWAPR::Pool object\fR )" 4.IX Item "ret: $p ( APR::Pool object )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.ie n .Sh """prev""".el .Sh "\f(CWprev\fP".IX Subsection "prev"Pointer to the previous request if this is an internal redirect.PP.Vb 1\& $prev_r = $r\->prev();.Ve.ie n .IP "obj: $r\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "obj: $r ( Apache2::RequestRec object )".PD 0.ie n .IP "ret: $prev_r\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "ret: \f(CW$prev_r\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "ret: $prev_r ( Apache2::RequestRec object )".PDa blessed reference to the previous (internal) request structure or\&\f(CW\*(C`undef\*(C'\fR if there is no previous request..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".ie n .Sh """proto_input_filters""".el .Sh "\f(CWproto_input_filters\fP".IX Subsection "proto_input_filters"Get the first filter in a linked list of protocol level input filters:.PP.Vb 2\& $proto_input_filters = $r\->proto_input_filters();\& $prev_proto_input_filters = $r\->proto_input_filters($new_proto_input_filters);.Ve.ie n .IP "obj: $r\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "obj: $r ( Apache2::RequestRec object )".PD 0.ie n .IP "opt arg1: $new_proto_input_filters" 4.el .IP "opt arg1: \f(CW$new_proto_input_filters\fR" 4.IX Item "opt arg1: $new_proto_input_filters".PDSet a new value.ie n .IP "ret: $proto_input_filters\fR ( \f(CW""Apache2::Filter object"" )" 4.el .IP "ret: \f(CW$proto_input_filters\fR ( \f(CWApache2::Filter object\fR )" 4.IX Item "ret: $proto_input_filters ( Apache2::Filter object )"The first filter in the protocol level input filters chain..SpIf \f(CW$new_proto_input_filters\fR was passed, returns the previous value..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PP\&\f(CW\*(C`$r\->proto_input_filters\*(C'\fR points to the same filter as\&\f(CW\*(C`$r\->connection\->input_filters\*(C'\fR..ie n .Sh """proto_num""".el .Sh "\f(CWproto_num\fP".IX Subsection "proto_num"Get current request's \s-1HTTP\s0 protocol version number.PP.Vb 1\& $proto_num = $r\->proto_num();.Ve.ie n .IP "obj: $r\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "obj: $r ( Apache2::RequestRec object )".PD 0.ie n .IP "ret: $proto_num (integer)" 4.el .IP "ret: \f(CW$proto_num\fR (integer)" 4.IX Item "ret: $proto_num (integer)".PDcurrent request's \s-1HTTP\s0 protocol version number, e.g.: \s-1HTTP/1\s0.0 ==1000, \s-1HTTP/1\s0.1 = 1001.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".ie n .Sh """proto_output_filters""".el .Sh "\f(CWproto_output_filters\fP".IX Subsection "proto_output_filters"Get the first filter in a linked list of protocol level outputfilters:.PP.Vb 2\& $proto_output_filters = $r\->proto_output_filters();\& $prev_proto_output_filters = $r\->proto_output_filters($new_proto_output_filters);.Ve.ie n .IP "obj: $r\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "obj: $r ( Apache2::RequestRec object )".PD 0.ie n .IP "opt arg1: $new_proto_output_filters" 4.el .IP "opt arg1: \f(CW$new_proto_output_filters\fR" 4.IX Item "opt arg1: $new_proto_output_filters".PDSet a new value.ie n .IP "ret: $proto_output_filters\fR ( \f(CW""Apache2::Filter object"" )" 4.el .IP "ret: \f(CW$proto_output_filters\fR ( \f(CWApache2::Filter object\fR )" 4.IX Item "ret: $proto_output_filters ( Apache2::Filter object )"The first filter in the protocol level output filters chain..SpIf \f(CW$new_proto_output_filters\fR was passed, returns the previous value..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PP\&\f(CW\*(C`$r\->proto_output_filters\*(C'\fR points to the same filter as\&\f(CW\*(C`$r\->connection\->output_filters\*(C'\fR..ie n .Sh """protocol""".el .Sh "\f(CWprotocol\fP".IX Subsection "protocol"Get a string identifying the protocol that the client speaks..PP.Vb 1\& $protocol = $r\->protocol();.Ve.ie n .IP "obj: $r\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "obj: $r ( Apache2::RequestRec object )".PD 0.ie n .IP "ret: $protocl ( string )" 4.el .IP "ret: \f(CW$protocl\fR ( string )" 4.IX Item "ret: $protocl ( string )".PDTypical values are \f(CW"HTTP/1.0"\fR or \f(CW"HTTP/1.1"\fR..SpIf the client didn't specify the protocol version, the default is\&\f(CW"HTTP/0.9"\fR.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".ie n .Sh """proxyreq""".el .Sh "\f(CWproxyreq\fP".IX Subsection "proxyreq"Get/set the \fIproxyrec\fR request record member and optionally adjustother related fields..PP.Vb 1\& $status = $r\->proxyreq($val);.Ve.ie n .IP "obj: $r\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "obj: $r ( Apache2::RequestRec object )".PD 0.ie n .IP "opt arg1: $val ( integer )" 4.el .IP "opt arg1: \f(CW$val\fR ( integer )" 4.IX Item "opt arg1: $val ( integer )".PD0, 1 or none..ie n .IP "ret: $status ( integer )" 4.el .IP "ret: \f(CW$status\fR ( integer )" 4.IX Item "ret: $status ( integer )"If \f(CW$val\fR is 0 or 1, the \fIproxyrec\fR member will be set to that valueand previous value will be returned..SpIf \f(CW$val\fR is not passed, and \f(CW\*(C`$r\->proxyreq\*(C'\fR is not true, and theproxy request is matching the current vhost (scheme, hostname andport), the \fIproxyrec\fR member will be set to 1 and that value will bereturned. In addition \f(CW\*(C`$r\->uri\*(C'\fR is set to \f(CW\*(C`$r\->unparsed_uri\*(C'\fRand \f(CW\*(C`$r\->filename\*(C'\fR is set to \f(CW\*(C`"modperl\-proxy:".$r\->uri\*(C'\fR. Ifthose conditions aren't true 0 is returned..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPFor example to turn a normal request into a proxy request to behandled on the same server in the \f(CW\*(C`PerlTransHandler\*(C'\fR phase run:.PP.Vb 5\& my $real_url = $r\->unparsed_uri;\& $r\->proxyreq(1);\& $r\->uri($real_url);\& $r\->filename("proxy:$real_url");\& $r\->handler(\*(Aqproxy\-server\*(Aq);.Ve.PPAlso remember that if you want to turn a proxy request into anon-proxy request, it's not enough to call:.PP.Vb 1\& $r\->proxyreq(0);.Ve.PPYou need to adjust \f(CW\*(C`$r\->uri\*(C'\fR and \f(CW\*(C`$r\->filename\*(C'\fR as well ifyou run that code in \f(CW\*(C`PerlPostReadRequestHandler\*(C'\fR phase, since if youdon't \*(-- \f(CW\*(C`mod_proxy\*(C'\fR's own post_read_request handler will overrideyour settings (as it will run after the mod_perl handler)..ie n .Sh """request_time""".el .Sh "\f(CWrequest_time\fP".IX Subsection "request_time"Time when the request started.PP.Vb 1\& $request_time = $r\->request_time();.Ve.ie n .IP "obj: $r\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "obj: $r ( Apache2::RequestRec object )".PD 0.ie n .IP "ret: $request_time (epoch seconds)." 4.el .IP "ret: \f(CW$request_time\fR (epoch seconds)." 4.IX Item "ret: $request_time (epoch seconds).".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.ie n .Sh """server""".el .Sh "\f(CWserver\fP".IX Subsection "server"Get the \f(CW\*(C`Apache2::Server\*(C'\fR object forthe server the request \f(CW$r\fR is running under..PP.Vb 1\& $s = $r\->server();.Ve.ie n .IP "obj: $r\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "obj: $r ( Apache2::RequestRec object )".PD 0.ie n .IP "ret: $s\fR ( \f(CW""Apache2::ServerRec object"" )" 4.el .IP "ret: \f(CW$s\fR ( \f(CWApache2::ServerRec object\fR )" 4.IX Item "ret: $s ( Apache2::ServerRec object )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.ie n .Sh """status""".el .Sh "\f(CWstatus\fP".IX Subsection "status"Get/set the reply status for the client request..PP.Vb 2\& $status = $r\->status();\& $prev_status = $r\->status($new_status);.Ve.ie n .IP "obj: $r\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "obj: $r ( Apache2::RequestRec object )".PD 0.ie n .IP "opt arg1: $new_status ( integer )" 4.el .IP "opt arg1: \f(CW$new_status\fR ( integer )" 4.IX Item "opt arg1: $new_status ( integer )".PDIf \f(CW$new_status\fR is passed the new status is assigned..SpNormally you would use some \f(CW\*(C`Apache2::Constconstant\*(C'\fR, e.g. \f(CW\*(C`Apache2::Const::REDIRECT\*(C'\fR..ie n .IP "ret: $newval ( integer )" 4.el .IP "ret: \f(CW$newval\fR ( integer )" 4.IX Item "ret: $newval ( integer )"The current value..SpIf \f(CW$new_status\fR is passed the old value is returned..IP "since: 2.0.00" 4
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -