📄 apache2::subrequest.3
字号:
This function is designed for things like actions or \s-1CGI\s0 scripts, whenusing \f(CW\*(C`AddHandler\*(C'\fR, and you want to preserve the content type acrossan internal redirect..ie n .Sh """lookup_file""".el .Sh "\f(CWlookup_file\fP".IX Subsection "lookup_file"Create a subrequest for the given file. This sub request can beinspected to find information about the requested file.PP.Vb 2\& $ret = $r\->lookup_file($new_file);\& $ret = $r\->lookup_file($new_file, $next_filter);.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 )"The current request.ie n .IP "arg1: $new_file ( string )" 4.el .IP "arg1: \f(CW$new_file\fR ( string )" 4.IX Item "arg1: $new_file ( string )"The file to lookup.ie n .IP "opt arg2: $next_filter\fR ( \f(CW""Apache2::Filter"" )" 4.el .IP "opt arg2: \f(CW$next_filter\fR ( \f(CWApache2::Filter\fR )" 4.IX Item "opt arg2: $next_filter ( Apache2::Filter )"See \f(CW\*(C`$r\->lookup_uri\*(C'\fR for details..ie n .IP "ret: $ret\fR ( \f(CW""Apache2::SubRequest object"" )" 4.el .IP "ret: \f(CW$ret\fR ( \f(CWApache2::SubRequest object\fR )" 4.IX Item "ret: $ret ( Apache2::SubRequest object )"The sub request record..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPSee \f(CW\*(C`$r\->lookup_uri\*(C'\fR for further discussion..ie n .Sh """lookup_method_uri""".el .Sh "\f(CWlookup_method_uri\fP".IX Subsection "lookup_method_uri"Create a sub request for the given \s-1URI\s0 using a specific method. Thissub request can be inspected to find information about the requested\&\s-1URI\s0.PP.Vb 2\& $ret = $r\->lookup_method_uri($method, $new_uri);\& $ret = $r\->lookup_method_uri($method, $new_uri, $next_filter);.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 )"The current request.ie n .IP "arg1: $method ( string )" 4.el .IP "arg1: \f(CW$method\fR ( string )" 4.IX Item "arg1: $method ( string )"The method to use in the new sub request (e.g. \f(CW"GET"\fR).ie n .IP "arg2: $new_uri ( string )" 4.el .IP "arg2: \f(CW$new_uri\fR ( string )" 4.IX Item "arg2: $new_uri ( string )"The \s-1URI\s0 to lookup.ie n .IP "opt arg3: $next_filter\fR ( \f(CW""Apache2::Filter object"" )" 4.el .IP "opt arg3: \f(CW$next_filter\fR ( \f(CWApache2::Filter object\fR )" 4.IX Item "opt arg3: $next_filter ( Apache2::Filter object )"See \f(CW\*(C`$r\->lookup_uri\*(C'\fR for details..ie n .IP "ret: $ret\fR ( \f(CW""Apache2::SubRequest object"" )" 4.el .IP "ret: \f(CW$ret\fR ( \f(CWApache2::SubRequest object\fR )" 4.IX Item "ret: $ret ( Apache2::SubRequest object )"The sub request record..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPSee \f(CW\*(C`$r\->lookup_uri\*(C'\fR for further discussion..ie n .Sh """lookup_uri""".el .Sh "\f(CWlookup_uri\fP".IX Subsection "lookup_uri"Create a sub request from the given \s-1URI\s0. This sub request can beinspected to find information about the requested \s-1URI\s0..PP.Vb 2\& $ret = $r\->lookup_uri($new_uri);\& $ret = $r\->lookup_uri($new_uri, $next_filter);.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 )"The current request.ie n .IP "arg1: $new_uri ( string )" 4.el .IP "arg1: \f(CW$new_uri\fR ( string )" 4.IX Item "arg1: $new_uri ( string )"The \s-1URI\s0 to lookup.ie n .IP "opt arg2: $next_filter\fR ( \f(CW""Apache2::Filter object"" )" 4.el .IP "opt arg2: \f(CW$next_filter\fR ( \f(CWApache2::Filter object\fR )" 4.IX Item "opt arg2: $next_filter ( Apache2::Filter object )"The first filter the subrequest should pass the data through. If notspecified it defaults to the first connection output filter for themain request\&\f(CW\*(C`$r\->proto_output_filters\*(C'\fR. Soif the subrequest sends any output it will be filtered only once. Iffor example you desire to apply the main request's output filters tothe sub-request output as well pass\&\f(CW\*(C`$r\->output_filters\*(C'\fRas an argument..ie n .IP "ret: $ret\fR ( \f(CW""Apache2::SubRequest object"" )" 4.el .IP "ret: \f(CW$ret\fR ( \f(CWApache2::SubRequest object\fR )" 4.IX Item "ret: $ret ( Apache2::SubRequest object )"The sub request record.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPHere is an example of a simple subrequest which serves uri\&\fI/new_uri\fR:.PP.Vb 2\& sub handler {\& my $r = shift;\& \& my $subr = $r\->lookup_uri("/new_uri");\& $sub\->run;\& \& return Apache2::Const::OK;\& }.Ve.PPIf let's say you have three request output filters registered to runfor the main request:.PP.Vb 3\& PerlOutputFilterHandler MyApache2::SubReqExample::filterA\& PerlOutputFilterHandler MyApache2::SubReqExample::filterB\& PerlOutputFilterHandler MyApache2::SubReqExample::filterC.Ve.PPand you wish to run them all, the code needs to become:.PP.Vb 1\& my $subr = $r\->lookup_uri("/new_uri", $r\->output_filters);.Ve.PPand if you wish to run them all, but the first one (\f(CW\*(C`filterA\*(C'\fR), thecode needs to be adjusted to be:.PP.Vb 1\& my $subr = $r\->lookup_uri("/new_uri", $r\->output_filters\->next);.Ve.ie n .Sh """run""".el .Sh "\f(CWrun\fP".IX Subsection "run"Run a sub-request.PP.Vb 1\& $rc = $subr\->run();.Ve.ie n .IP "obj: $subr\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "obj: \f(CW$subr\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "obj: $subr ( Apache2::RequestRec object )"The sub-request (e.g. returned by \f(CW\*(C`lookup_uri\*(C'\fR).ie n .IP "ret: $rc ( integer )" 4.el .IP "ret: \f(CW$rc\fR ( integer )" 4.IX Item "ret: $rc ( integer )"The return code of the handler (\f(CW\*(C`Apache2::Const::OK\*(C'\fR, \f(CW\*(C`Apache2::Const::DECLINED\*(C'\fR,etc.).IP "since: 2.0.00" 4.IX Item "since: 2.0.00".SH "Unsupported API".IX Header "Unsupported API"\&\f(CW\*(C`Apache2::SubRequest\*(C'\fR also provides auto-generated Perl interface fora few other methods which aren't tested at the moment and thereforetheir \s-1API\s0 is a subject to change. These methods will be finalizedlater as a need arises. If you want to rely on any of the followingmethods please contact the the mod_perl development mailinglist so we can help each other take the steps necessaryto shift the method to an officially supported \s-1API\s0..ie n .Sh """internal_fast_redirect""".el .Sh "\f(CWinternal_fast_redirect\fP".IX Subsection "internal_fast_redirect"\&\s-1META:\s0 Autogenerated \- needs to be reviewed/completed.PPRedirect the current request to a sub_req, merging the pools.PP.Vb 1\& $r\->internal_fast_redirect($sub_req);.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 )"The current request.ie n .IP "arg1: $sub_req ( string )" 4.el .IP "arg1: \f(CW$sub_req\fR ( string )" 4.IX Item "arg1: $sub_req ( string )"A subrequest created from this request.IP "ret: no return value" 4.IX Item "ret: no return value".PD 0.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PP\&\s-1META:\s0 httpd\-2.0/modules/http/http_request.c declares this function as:.PP.Vb 1\& /* XXX: Is this function is so bogus and fragile that we deep\-6 it? */.Ve.PPdo we really want to expose it to mod_perl users?.ie n .Sh """lookup_dirent""".el .Sh "\f(CWlookup_dirent\fP".IX Subsection "lookup_dirent"\&\s-1META:\s0 Autogenerated \- needs to be reviewed/completed.PPCreate a sub request for the given apr_dir_read result. This sub requestcan be inspected to find information about the requested file.PP.Vb 3\& $lr = $r\->lookup_dirent($finfo);\& $lr = $r\->lookup_dirent($finfo, $subtype);\& $lr = $r\->lookup_dirent($finfo, $subtype, $next_filter);.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 )"The current request.ie n .IP "arg1: $finfo\fR ( \f(CW""APR::Finfo object"" )" 4.el .IP "arg1: \f(CW$finfo\fR ( \f(CWAPR::Finfo object\fR )" 4.IX Item "arg1: $finfo ( APR::Finfo object )"The apr_dir_read result to lookup.ie n .IP "arg2: $subtype ( integer )" 4.el .IP "arg2: \f(CW$subtype\fR ( integer )" 4.IX Item "arg2: $subtype ( integer )"What type of subrequest to perform, one of;.Sp.Vb 2\& Apache2::SUBREQ_NO_ARGS ignore r\->args and r\->path_info\& Apache2::SUBREQ_MERGE_ARGS merge r\->args and r\->path_info.Ve.ie n .IP "arg3: $next_filter ( integer )" 4.el .IP "arg3: \f(CW$next_filter\fR ( integer )" 4.IX Item "arg3: $next_filter ( integer )"The first filter the sub_request should use. If this is\&\s-1NULL\s0, it defaults to the first filter for the main request.ie n .IP "ret: $lr\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "ret: \f(CW$lr\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "ret: $lr ( Apache2::RequestRec object )"The new request record.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PP\&\s-1META:\s0 where do we take the apr_dir_read result from?.SH "See Also".IX Header "See Also"mod_perl 2.0 documentation..SH "Copyright".IX Header "Copyright"mod_perl 2.0 and its core modules are copyrighted underThe Apache Software License, Version 2.0..SH "Authors".IX Header "Authors"The mod_perl development team and numerouscontributors.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -