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

📄 apache2::requestutil.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 3 页
字号:
.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 )".PDA key value.ie n .IP "opt arg2: $val ( \s-1SCALAR\s0 )" 4.el .IP "opt arg2: \f(CW$val\fR ( \s-1SCALAR\s0 )" 4.IX Item "opt arg2: $val ( SCALAR )"Any scalar value (e.g. a reference to an array).IP "ret: (3 different possible values)" 4.IX Item "ret: (3 different possible values)"if both, \f(CW$key\fR and \f(CW$val\fR are passed the previous value for \f(CW$key\fRis returned if such existed, otherwise \f(CW\*(C`undef\*(C'\fR is returned..Spif only \f(CW$key\fR is passed, the current value for the given key isreturned..Spif no arguments are passed, a hash reference is returned, which canthen be directly accessed without going through the \f(CW\*(C`pnotes()\*(C'\fRinterface..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPThis method provides functionality similar to(\f(CW\*(C`Apache2::RequestRec::notes\*(C'\fR),but values can be any Perl variables. That also means that it can beused only between Perl modules..PPThe values get reset automatically at the end of each \s-1HTTP\s0 request..PPExamples:.PPSet a key/value pair:.PP.Vb 1\&  $r\->pnotes(foo => [1..5]);.Ve.PPGet the value:.PP.Vb 1\&  $val = $r\->pnotes("foo");.Ve.PP\&\f(CW$val\fR now contains an array ref containing 5 elements (\f(CW1..5\fR)..PPNow change the existing value:.PP.Vb 2\&  $old_val = $r\->pnotes(foo => [\*(Aqa\*(Aq..\*(Aqc\*(Aq]);\&  $val = $r\->pnotes("foo");.Ve.PP\&\f(CW$old_val\fR now contains an array ref with 5 elements (\f(CW1..5\fR) and\&\f(CW$val\fR contains an array ref with 3 elements \f(CW\*(Aqa\*(Aq\fR, \f(CW\*(Aqb\*(Aq\fR, \f(CW\*(Aqc\*(Aq\fR..PPAlternatively you can access the hash reference with all pnotesvalues:.PP.Vb 1\&  $pnotes = $r\->pnotes;.Ve.PPNow we can read what's in there for the key \fIfoo\fR:.PP.Vb 1\&  $val = $pnotes\->{foo};.Ve.PPand as before \f(CW$val\fR still gives us an array ref with 3 elements\&\f(CW\*(Aqa\*(Aq\fR, \f(CW\*(Aqb\*(Aq\fR, \f(CW\*(Aqc\*(Aq\fR..PPNow we can add elements to it:.PP.Vb 1\&  push @{ $pnotes{foo} }, \*(Aqd\*(Aq..\*(Aqf\*(Aq;.Ve.PPand we can try to retrieve them using the hash and non-hash \s-1API:\s0.PP.Vb 2\&  $val1 = $pnotes{foo};\&  $val2 = $r\->pnotes("foo");.Ve.PPBoth \f(CW$val1\fR and \f(CW$val2\fR contain an array ref with 6 elements(letters 'a' to 'f')..PPFinally to reset an entry you could just assign \f(CW\*(C`undef\*(C'\fR as a value:.PP.Vb 1\&  $r\->pnotes(foo => undef);.Ve.PPbut the entry for the key \fIfoo\fR still remains with the value\&\f(CW\*(C`undef\*(C'\fR. If you really want to completely remove it, use the hashinterface:.PP.Vb 1\&  delete $r\->pnotes\->{foo};.Ve.ie n .Sh """psignature""".el .Sh "\f(CWpsignature\fP".IX Subsection "psignature"Get \s-1HTML\s0 describing the address and (optionally) admin of the server..PP.Vb 1\&  $sig = $r\->psignature($prefix);.Ve.ie n .IP "obj: $r\fR ( \f(CW""Apache2::RequestRec"" )" 4.el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec\fR )" 4.IX Item "obj: $r ( Apache2::RequestRec )".PD 0.ie n .IP "arg1: $prefix ( string )" 4.el .IP "arg1: \f(CW$prefix\fR ( string )" 4.IX Item "arg1: $prefix ( string )".PDText which is prepended to the return value.ie n .IP "ret: $sig ( string )" 4.el .IP "ret: \f(CW$sig\fR ( string )" 4.IX Item "ret: $sig ( string )"\&\s-1HTML\s0 text describing the server. Note that depending on the value ofthe \f(CW\*(C`ServerSignature\*(C'\fR directive, the function may return the address,including the admin information or nothing at all..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".ie n .Sh """request""".el .Sh "\f(CWrequest\fP".IX Subsection "request"Get/set the ( \f(CW\*(C`Apache2::RequestRecobject\*(C'\fR ) object for the currentrequest..PP.Vb 2\&  $r = Apache2::RequestUtil\->request;\&       Apache2::RequestUtil\->request($new_r);.Ve.ie n .IP "obj: ""Apache2"" (class name)" 4.el .IP "obj: \f(CWApache2\fR (class name)" 4.IX Item "obj: Apache2 (class name)"The Apache class name.ie n .IP "opt arg1: $new_r\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "opt arg1: \f(CW$new_r\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "opt arg1: $new_r ( Apache2::RequestRec object )".PD 0.ie n .IP "ret: $r\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "ret: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "ret: $r ( Apache2::RequestRec object )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PPThe get-able part of this method is only available if \f(CW\*(C`PerlOptions+GlobalRequest\*(C'\fR isin effect or if \f(CW\*(C`Apache2\->request($new_r)\*(C'\fR was called earlier. Soinstead of setting \f(CW\*(C`PerlOptions+GlobalRequest\*(C'\fR, onecan set the global request from within the handler..ie n .Sh """push_handlers""".el .Sh "\f(CWpush_handlers\fP".IX Subsection "push_handlers"Add one or more handlers to a list of handlers to be called for agiven phase..PP.Vb 2\&  $ok = $r\->push_handlers($hook_name => \e&handler);\&  $ok = $r\->push_handlers($hook_name => [\*(AqFoo::Bar::handler\*(Aq, \e&handler2]);.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: $hook_name ( string )" 4.el .IP "arg1: \f(CW$hook_name\fR ( string )" 4.IX Item "arg1: $hook_name ( string )".PDthe phase to add the handlers to.ie n .IP "arg2: $handlers ( \s-1CODE\s0 ref or \s-1SUB\s0 name or an \s-1ARRAY\s0 ref )" 4.el .IP "arg2: \f(CW$handlers\fR ( \s-1CODE\s0 ref or \s-1SUB\s0 name or an \s-1ARRAY\s0 ref )" 4.IX Item "arg2: $handlers ( CODE ref or SUB name or an ARRAY ref )"a single handler \s-1CODE\s0 reference or just a name of the subroutine(fully qualified unless defined in the current package)..Spif more than one passed, use a reference to an array of \s-1CODE\s0 refsand/or subroutine names..ie n .IP "ret: $ok ( boolean )" 4.el .IP "ret: \f(CW$ok\fR ( boolean )" 4.IX Item "ret: $ok ( boolean )"returns a true value on success, otherwise a false value.IP "since: 2.0.00" 4.IX Item "since: 2.0.00"See also:\&\f(CW\*(C`$s\->add_config\*(C'\fR.SpNote that to push input/output filters you have to use\&\f(CW\*(C`Apache2::Filter\*(C'\fR methods:\&\f(CW\*(C`add_input_filter\*(C'\fRand\&\f(CW\*(C`add_output_filter\*(C'\fR..PPExamples:.PPA single handler:.PP.Vb 1\&  $r\->push_handlers(PerlResponseHandler => \e&handler);.Ve.PPMultiple handlers:.PP.Vb 1\&  $r\->push_handlers(PerlFixupHandler => [\*(AqFoo::Bar::handler\*(Aq, \e&handler2]);.Ve.PPAnonymous functions:.PP.Vb 1\&  $r\->push_handlers(PerlLogHandler => sub { return Apache2::Const::OK });.Ve.ie n .Sh """set_basic_credentials""".el .Sh "\f(CWset_basic_credentials\fP".IX Subsection "set_basic_credentials"Populate the incoming request headers table (\f(CW\*(C`headers_in\*(C'\fR) withauthentication headers for Basic Authorization as if the client hassubmitted those in first place:.PP.Vb 1\&  $r\->set_basic_credentials($username, $password);.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: $username ( string )" 4.el .IP "arg1: \f(CW$username\fR ( string )" 4.IX Item "arg1: $username ( string )".ie n .IP "arg2: $password ( string )" 4.el .IP "arg2: \f(CW$password\fR ( string )" 4.IX Item "arg2: $password ( string )".IP "ret: no return value" 4.IX Item "ret: no return value".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PPSee for example the Command Server protocolexample whichreuses \s-1HTTP\s0 \s-1AAA\s0 model under non-HTTP protocol..ie n .Sh """set_handlers""".el .Sh "\f(CWset_handlers\fP".IX Subsection "set_handlers"Set a list of handlers to be called for a given phase. Any previouslyset handlers are forgotten..PP.Vb 4\&  $ok = $r\->set_handlers($hook_name => \e&handler);\&  $ok = $r\->set_handlers($hook_name => [\*(AqFoo::Bar::handler\*(Aq, \e&handler2]);\&  $ok = $r\->set_handlers($hook_name => []);\&  $ok = $r\->set_handlers($hook_name => undef);.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: $hook_name ( string )" 4.el .IP "arg1: \f(CW$hook_name\fR ( string )" 4.IX Item "arg1: $hook_name ( string )".PDthe phase to set the handlers in.ie n .IP "arg2: $handlers (\s-1CODE\s0 ref or \s-1SUB\s0 name or an \s-1ARRAY\s0 ref)" 4.el .IP "arg2: \f(CW$handlers\fR (\s-1CODE\s0 ref or \s-1SUB\s0 name or an \s-1ARRAY\s0 ref)" 4.IX Item "arg2: $handlers (CODE ref or SUB name or an ARRAY ref)"a reference to a single handler \s-1CODE\s0 reference or just a name of thesubroutine (fully qualified unless defined in the current package)..Spif more than one passed, use a reference to an array of \s-1CODE\s0 refsand/or subroutine names..Spif the argument is \f(CW\*(C`undef\*(C'\fR or \f(CW\*(C`[]\*(C'\fR the list of handlers is reset tozero..ie n .IP "ret: $ok ( boolean )" 4.el .IP "ret: \f(CW$ok\fR ( boolean )" 4.IX Item "ret: $ok ( boolean )"returns a true value on success, otherwise a false value.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPSee also:\&\f(CW\*(C`$s\->add_config\*(C'\fR.PPExamples:.PPA single handler:.PP.Vb 1\&  $r\->set_handlers(PerlResponseHandler => \e&handler);.Ve.PPMultiple handlers:.PP.Vb 1\&  $r\->set_handlers(PerlFixupHandler => [\*(AqFoo::Bar::handler\*(Aq, \e&handler2]);.Ve.PPAnonymous functions:.PP.Vb 1\&  $r\->set_handlers(PerlLogHandler => sub { return Apache2::Const::OK });.Ve.PPReset any previously set handlers:.PP.Vb 1\&  $r\->set_handlers(PerlCleanupHandler => []);.Ve.PPor.PP.Vb 1\&  $r\->set_handlers(PerlCleanupHandler => undef);.Ve.ie n .Sh """slurp_filename""".el .Sh "\f(CWslurp_filename\fP".IX Subsection "slurp_filename"Slurp the contents of \f(CW\*(C`$r\->filename\*(C'\fR:.PP.Vb 1\&  $content_ref = $r\->slurp_filename($tainted);.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: $tainted (number)" 4.el .IP "arg1: \f(CW$tainted\fR (number)" 4.IX Item "arg1: $tainted (number)".PDIf the server is run under the tainting mode (\f(CW\*(C`\-T\*(C'\fR) which we hope youdo, by default the returned data is tainted. If an optional\&\f(CW$tainted\fR flag is set to zero, the data will be marked asnon-tainted..SpDo \fBnot\fR set this flag to zero unless you know what you are doing,you may create a security hole in your program if you do. For moreinformation see the \fIperlsec\fR manpage..SpIf you wonder why this option is available, it is used internally bythe \f(CW\*(C`ModPerl::Registry\*(C'\fR handlerand friends, because the \s-1CGI\s0 scripts that it reads are considered safe(you could just as well \f(CW\*(C`require()\*(C'\fR them)..ie n .IP "ret: $content_ref ( \s-1SCALAR\s0 ref )" 4.el .IP "ret: \f(CW$content_ref\fR ( \s-1SCALAR\s0 ref )" 4.IX Item "ret: $content_ref ( SCALAR ref )"A reference to a string with the contents.ie n .IP "excpt: ""APR::Error""" 4.el .IP "excpt: \f(CWAPR::Error\fR" 4.IX Item "excpt: APR::Error"Possible error codes could be:\&\f(CW\*(C`APR::Const::EACCES\*(C'\fR(permission problems),\&\f(CW\*(C`APR::Const::ENOENT\*(C'\fR(file not found), and others. For checking such error codes, see thedocumentation for, for example,\&\f(CW\*(C`APR::Status::is_EACCES\*(C'\fRand\&\f(CW\*(C`APR::Status::is_ENOENT\*(C'\fR..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPNote that if you assign to \f(CW\*(C`$r\->filename\*(C'\fR you need to updateits stat record..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 + -