⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apache2::requestrec.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 5 页
字号:
.IX Item "since: 2.0.00".PPUsually you will set this value indirectly by returning the statuscode as the handler's function result.  However, there are rareinstances when you want to trick Apache into thinking that the modulereturned an \f(CW\*(C`Apache2::Const::OK\*(C'\fR status code, but actually send the browser anon-OK status. This may come handy when implementing an \s-1HTTP\s0 proxyhandler.  The proxy handler needs to send to the client, whateverstatus code the proxied server has returned, while returning\&\f(CW\*(C`Apache2::Const::OK\*(C'\fR to Apache. e.g.:.PP.Vb 2\&  $r\->status($some_code);\&  return Apache2::Const::OK.Ve.PPSee also \f(CW\*(C`$r\->status_line\*(C'\fR, which. if set,overrides \f(CW\*(C`$r\->status\*(C'\fR..ie n .Sh """status_line""".el .Sh "\f(CWstatus_line\fP".IX Subsection "status_line"Get/set the response status line.  The status line is a string like\&\*(L"200 Document follows\*(R" and it will take precedence over the valuespecified using the \f(CW\*(C`$r\->status()\*(C'\fR described above..PP.Vb 2\&  $status_line      = $r\->status_line();\&  $prev_status_line = $r\->status_line($new_status_line);.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_line ( string )" 4.el .IP "opt arg1: \f(CW$new_status_line\fR ( string )" 4.IX Item "opt arg1: $new_status_line ( string )".ie n .IP "ret: $status_line ( string )" 4.el .IP "ret: \f(CW$status_line\fR ( string )" 4.IX Item "ret: $status_line ( string )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PPWhen discussing \f(CW\*(C`$r\->status\*(C'\fR we have mentioned thatsometimes a handler runs to a successful completion, but may need toreturn a different code, which is the case with the proxyserver. Assuming that the proxy handler forwards to the clientwhatever response the proxied server has sent, it'll usually use\&\f(CW\*(C`status_line()\*(C'\fR, like so:.PP.Vb 2\&  $r\->status_line($response\->code() . \*(Aq \*(Aq . $response\->message());\&  return Apache2::Const::OK;.Ve.PPIn this example \f(CW$response\fR could be for example an \f(CW\*(C`HTTP::Response\*(C'\fRobject, if \f(CW\*(C`LWP::UserAgent\*(C'\fR was used to implement the proxy..PPThis method is also handy when you extend the \s-1HTTP\s0 protocol and addnew response codes. For example you could invent a new error code andtell Apache to use that in the response like so:.PP.Vb 2\&  $r\->status_line("499 We have been FooBared");\&  return Apache2::Const::OK;.Ve.PPHere \f(CW499\fR is the new response code, and \fIWe have been FooBared\fR isthe custom response message..ie n .Sh """subprocess_env""".el .Sh "\f(CWsubprocess_env\fP".IX Subsection "subprocess_env"Get/set the Apache \f(CW\*(C`subprocess_env\*(C'\fR table, or optionally set thevalue of a named entry..PP.Vb 2\&               $r\->subprocess_env;\&  $env_table = $r\->subprocess_env;\&  \&         $r\->subprocess_env($key => $val);\&  $val = $r\->subprocess_env($key);.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: $key ( string )" 4.el .IP "opt arg1: \f(CW$key\fR ( string )" 4.IX Item "opt arg1: $key ( string )".ie n .IP "opt arg2: $val ( string )" 4.el .IP "opt arg2: \f(CW$val\fR ( string )" 4.IX Item "opt arg2: $val ( string )".ie n .IP "ret: ""...""" 4.el .IP "ret: \f(CW...\fR" 4.IX Item "ret: ...".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PPWhen called in \s-1VOID\s0 context with no arguments, it populate \f(CW%ENV\fRwith special variables (e.g. \f(CW$ENV{QUERY_STRING}\fR) like mod_cgidoes..PPWhen called in a non-VOID context with no arguments, it returns an\&\f(CW\*(C`APR::Table object\*(C'\fR..PPWhen the \f(CW$key\fR argument (string) is passed, it returns thecorresponding value (if such exists, or \f(CW\*(C`undef\*(C'\fR. The following twolines are equivalent:.PP.Vb 2\&  $val = $r\->subprocess_env($key);\&  $val = $r\->subprocess_env\->get($key);.Ve.PPWhen the \f(CW$key\fR and the \f(CW$val\fR arguments (strings) are passed, thevalue is set. The following two lines are equivalent:.PP.Vb 2\&  $r\->subprocess_env($key => $val);\&  $r\->subprocess_env\->set($key => $val);.Ve.PPThe \f(CW\*(C`subprocess_env\*(C'\fR \f(CW\*(C`table\*(C'\fR is usedby \f(CW\*(C`Apache2::SubProcess\*(C'\fR, topass environment variables to externally spawned processes. It's alsoused by various Apache modules, and you should use this table to passthe environment variables. For example if in\&\f(CW\*(C`PerlHeaderParserHandler\*(C'\fR you do:.PP.Vb 1\&   $r\->subprocess_env(MyLanguage => "de");.Ve.PPyou can then deploy \f(CW\*(C`mod_include\*(C'\fR and write in \fI.shtml\fR document:.PP.Vb 7\&   <!\-\-#if expr="$MyLanguage = en" \-\->\&   English\&   <!\-\-#elif expr="$MyLanguage = de" \-\->\&   Deutsch\&   <!\-\-#else \-\->\&   Sorry\&   <!\-\-#endif \-\->.Ve.ie n .Sh """the_request""".el .Sh "\f(CWthe_request\fP".IX Subsection "the_request"First \s-1HTTP\s0 request header.PP.Vb 1\&  $request = $r\->the_request();.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 ( string )" 4.el .IP "ret: \f(CW$request\fR ( string )" 4.IX Item "ret: $request ( string )".PDFor example:.Sp.Vb 1\&  GET /foo/bar/my_path_info?args=3 HTTP/1.0.Ve.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".ie n .Sh """unparsed_uri""".el .Sh "\f(CWunparsed_uri\fP".IX Subsection "unparsed_uri"The \s-1URI\s0 without any parsing performed.PP.Vb 1\&  $unparsed_uri = $r\->unparsed_uri();.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: $unparsed_uri ( string )" 4.el .IP "ret: \f(CW$unparsed_uri\fR ( string )" 4.IX Item "ret: $unparsed_uri ( string )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PPIf for example the request was:.PP.Vb 1\&  GET /foo/bar/my_path_info?args=3 HTTP/1.0.Ve.PP\&\f(CW\*(C`$r\->uri\*(C'\fR returns:.PP.Vb 1\&  /foo/bar/my_path_info.Ve.PPwhereas \f(CW\*(C`$r\->unparsed_uri\*(C'\fR returns:.PP.Vb 1\&  /foo/bar/my_path_info?args=3.Ve.ie n .Sh """uri""".el .Sh "\f(CWuri\fP".IX Subsection "uri"The path portion of the \s-1URI\s0.PP.Vb 2\&  $uri         = $r\->uri();\&  my $prec_uri = $r\->uri($new_uri);.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_uri ( string )" 4.el .IP "opt arg1: \f(CW$new_uri\fR ( string )" 4.IX Item "opt arg1: $new_uri ( string )".ie n .IP "ret: $uri ( string )" 4.el .IP "ret: \f(CW$uri\fR ( string )" 4.IX Item "ret: $uri ( string )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PPSee the example in the \f(CW\*(C`$r\->unparsed_uri\*(C'\fRsection..ie n .Sh """user""".el .Sh "\f(CWuser\fP".IX Subsection "user"Get the user name, if an authentication process was successful. Orset it..PP.Vb 2\&  $user      = $r\->user();\&  $prev_user = $r\->user($new_user);.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_user ( string )" 4.el .IP "opt arg1: \f(CW$new_user\fR ( string )" 4.IX Item "opt arg1: $new_user ( string )".PDPass \f(CW$new_user\fR to set a new value.ie n .IP "ret: $user ( string )" 4.el .IP "ret: \f(CW$user\fR ( string )" 4.IX Item "ret: $user ( string )"The current username if an authentication process was successful..SpIf \f(CW$new_user\fR was passed, the previous value is returned..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPFor example, let's print the username passed by the client:.PP.Vb 3\&  my ($res, $sent_pw) = $r\->get_basic_auth_pw;\&  return $res if $res != Apache2::Const::OK;\&  print "User: ", $r\->user;.Ve.SH "Unsupported API".IX Header "Unsupported API"\&\f(CW\*(C`Apache2::RequestRec\*(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 """allowed_methods""".el .Sh "\f(CWallowed_methods\fP".IX Subsection "allowed_methods"\&\s-1META:\s0 Autogenerated \- needs to be reviewed/completed.PPList of allowed methods.PP.Vb 1\&  $list = $r\->allowed_methods();.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: $list\fR ( \f(CW""Apache2::MethodList object"" )" 4.el .IP "ret: \f(CW$list\fR ( \f(CWApache2::MethodList object\fR )" 4.IX Item "ret: $list ( Apache2::MethodList object )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PP\&\s-1META:\s0 Apache2::MethodList is not available at the moment.ie n .Sh """allowed_xmethods""".el .Sh "\f(CWallowed_xmethods\fP".IX Subsection "allowed_xmethods"\&\s-1META:\s0 Autogenerated \- needs to be reviewed/completed.PPArray of extension methods.PP.Vb 1\&  $array = $r\->allowed_xmethods();.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: $array\fR ( \f(CW""APR::ArrayHeader object"" )" 4.el .IP "ret: \f(CW$array\fR ( \f(CWAPR::ArrayHeader object\fR )" 4.IX Item "ret: $array ( APR::ArrayHeader object )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PP\&\s-1META:\s0 APR::ArrayHeader is not available at the moment.ie n .Sh """request_config""".el .Sh "\f(CWrequest_config\fP".IX Subsection "request_config"Config vector containing pointers to request's per-server configstructures.PP.Vb 1\&  $ret = $r\->request_config($newval);.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: $newval\fR ( \f(CW""Apache2::ConfVector object"" )" 4.el .IP "opt arg1: \f(CW$newval\fR ( \f(CWApache2::ConfVector object\fR )" 4.IX Item "opt arg1: $newval ( Apache2::ConfVector object )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.ie n .Sh """used_path_info""".el .Sh "\f(CWused_path_info\fP".IX Subsection "used_path_info"\&\s-1META:\s0 Autogenerated \- needs to be reviewed/completed.PPFlag for the handler to accept or reject path_info onthe current request.  All modules should respect the\&\s-1AP_REQ_ACCEPT_PATH_INFO\s0 and \s-1AP_REQ_REJECT_PATH_INFO\s0values, while \s-1AP_REQ_DEFAULT_PATH_INFO\s0 indicates theymay follow existing conventions.  This is set to theuser's preference upon \s-1HOOK_VERY_FIRST\s0 of the fixups..PP.Vb 1\&  $ret = $r\->used_path_info($newval);.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 "arg1: $newval (integer)" 4.el .IP "arg1: \f(CW$newval\fR (integer)" 4.IX Item "arg1: $newval (integer)".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.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 + -