apache2::connection.3

来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· 3 代码 · 共 775 行 · 第 1/2 页

3
775 行
字号
.PDSet a new value.ie n .IP "ret: $input_filters\fR ( \f(CW""Apache2::Filter object"" )" 4.el .IP "ret: \f(CW$input_filters\fR ( \f(CWApache2::Filter object\fR )" 4.IX Item "ret: $input_filters ( Apache2::Filter object )"The first filter in the connection input filters chain..SpIf \f(CW$new_input_filters\fR was passed, returns the previous value..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPFor an example see: Bucket Brigades-based ProtocolModule.ie n .Sh """keepalive""".el .Sh "\f(CWkeepalive\fP".IX Subsection "keepalive"This method answers the question: Should the the connection be keptalive for another \s-1HTTP\s0 request after the current request is completed?.PP.Vb 2\&  $status = $c\->keepalive();\&  $status = $c\->keepalive($new_status);.Ve.ie n .IP "obj: $c\fR ( \f(CW""Apache2::Connection object"" )" 4.el .IP "obj: \f(CW$c\fR ( \f(CWApache2::Connection object\fR )" 4.IX Item "obj: $c ( Apache2::Connection object )".PD 0.ie n .IP "opt arg1: $new_status\fR ( \f(CW"":conn_keepalive constant"" )" 4.el .IP "opt arg1: \f(CW$new_status\fR ( \f(CW:conn_keepalive constant\fR )" 4.IX Item "opt arg1: $new_status ( :conn_keepalive constant )".PDNormally you should not mess with setting this option when handlingthe \s-1HTTP\s0 protocol. If you do (for example when sending your ownheaders set with\&\f(CW\*(C`$r\->assbackwards\*(C'\fR)\&\*(-- take a look at the \fIap_set_keepalive()\fR function in\&\fIhttpd\-2.0/modules/http/http_protocol.c\fR..ie n .IP "ret: $status\fR ( \f(CW"":conn_keepalive constant"" )" 4.el .IP "ret: \f(CW$status\fR ( \f(CW:conn_keepalive constant\fR )" 4.IX Item "ret: $status ( :conn_keepalive constant )"The method does \fBnot\fR return true or false, but one of the stateswhich can be compared against (\f(CW\*(C`:conn_keepaliveconstants\*(C'\fR)..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPUnless you set this value yourself when implementing non-HTTPprotocols, it's only relevant for \s-1HTTP\s0 requests..PPFor example:.PP.Vb 2\&  use Apache2::RequestRec ();\&  use Apache2::Connection ();\&  \&  use Apache2::Const \-compile => qw(:conn_keepalive);\&  ...\&  my $c = $r\->connection;\&  if ($c\->keepalive == Apache2::Const::CONN_KEEPALIVE) {\&      # do something\&  }\&  elsif ($c\->keepalive == Apache2::Const::CONN_CLOSE) {\&      # do something else\&  }\&  elsif ($c\->keepalive == Apache2::Const::CONN_UNKNOWN) {\&      # do yet something else\&  }\&  else {\&      # die "unknown state";\&  }.Ve.PPNotice that new states could be added later by Apache, so your codeshould make no assumptions and do things only if the desired statematches..ie n .Sh """keepalives""".el .Sh "\f(CWkeepalives\fP".IX Subsection "keepalives"How many requests were already served over the current connection..PP.Vb 2\&  $served = $c\->keepalives();\&  $served = $c\->keepalives($new_served);.Ve.ie n .IP "obj: $c\fR ( \f(CW""Apache2::Connection object"" )" 4.el .IP "obj: \f(CW$c\fR ( \f(CWApache2::Connection object\fR )" 4.IX Item "obj: $c ( Apache2::Connection object )".PD 0.ie n .IP "opt arg1: $new_served (integer)" 4.el .IP "opt arg1: \f(CW$new_served\fR (integer)" 4.IX Item "opt arg1: $new_served (integer)".PDSet the number of served requests over the currentconnection. Normally you won't do that when handling \s-1HTTP\s0requests. (But see below a note regarding\&\f(CW\*(C`$r\->assbackwards\*(C'\fR)..ie n .IP "ret: $served (integer)" 4.el .IP "ret: \f(CW$served\fR (integer)" 4.IX Item "ret: $served (integer)"How many requests were already served over the current connection..SpIn most handlers, but \s-1HTTP\s0 output filter handlers, that value doesn'tcount the current request. For the latter it'll count the currentrequest..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPThis method is only relevant for keepaliveconnections. The core connection output filter\&\f(CW\*(C`ap_http_header_filter\*(C'\fR increments this value when the responseheaders are sent and it decides that the connection should not beclosed (see \f(CW\*(C`ap_set_keepalive()\*(C'\fR)..PPIf you send your own set of \s-1HTTP\s0 headers with\&\f(CW\*(C`$r\->assbackwards\*(C'\fR,which includes the \f(CW\*(C`Keep\-Alive\*(C'\fR \s-1HTTP\s0 response header, you must makesure to increment the \f(CW\*(C`keepalives\*(C'\fR counter..ie n .Sh """local_addr""".el .Sh "\f(CWlocal_addr\fP".IX Subsection "local_addr"Get this connection's local socket address.PP.Vb 1\&  $local_sa = $c\->local_addr();.Ve.ie n .IP "obj: $c\fR ( \f(CW""Apache2::Connection object"" )" 4.el .IP "obj: \f(CW$c\fR ( \f(CWApache2::Connection object\fR )" 4.IX Item "obj: $c ( Apache2::Connection object )".PD 0.ie n .IP "ret: $local_sa\fR ( \f(CW""APR::SockAddr object"" )" 4.el .IP "ret: \f(CW$local_sa\fR ( \f(CWAPR::SockAddr object\fR )" 4.IX Item "ret: $local_sa ( APR::SockAddr object )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.ie n .Sh """local_host""".el .Sh "\f(CWlocal_host\fP".IX Subsection "local_host"used for ap_get_server_name when UseCanonicalName is set to \s-1DNS\s0(ignores setting of HostnameLookups).PP.Vb 1\&  $local_host = $c\->local_host();.Ve.ie n .IP "obj: $c\fR ( \f(CW""Apache2::Connection object"" )" 4.el .IP "obj: \f(CW$c\fR ( \f(CWApache2::Connection object\fR )" 4.IX Item "obj: $c ( Apache2::Connection object )".PD 0.ie n .IP "ret: $local_host (string)" 4.el .IP "ret: \f(CW$local_host\fR (string)" 4.IX Item "ret: $local_host (string)".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PP\&\s-1META:\s0 you probably shouldn't use this method, but (\&\f(CW\*(C`get_server_name\*(C'\fR) if inside request and \f(CW$r\fR is available..ie n .Sh """local_ip""".el .Sh "\f(CWlocal_ip\fP".IX Subsection "local_ip"server \s-1IP\s0 address.PP.Vb 1\&  $local_ip = $c\->local_ip();.Ve.ie n .IP "obj: $c\fR ( \f(CW""Apache2::Connection object"" )" 4.el .IP "obj: \f(CW$c\fR ( \f(CWApache2::Connection object\fR )" 4.IX Item "obj: $c ( Apache2::Connection object )".PD 0.ie n .IP "ret: $local_ip (string)" 4.el .IP "ret: \f(CW$local_ip\fR (string)" 4.IX Item "ret: $local_ip (string)".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.ie n .Sh """notes""".el .Sh "\f(CWnotes\fP".IX Subsection "notes"Get/set text notes for the duration of this connection. These notes canbe passed from one module to another (not only mod_perl, but modulesin any other language):.PP.Vb 2\&  $notes      = $c\->notes();\&  $prev_notes = $c\->notes($new_notes);.Ve.ie n .IP "obj: $c\fR ( \f(CW""Apache2::Connection object"" )" 4.el .IP "obj: \f(CW$c\fR ( \f(CWApache2::Connection object\fR )" 4.IX Item "obj: $c ( Apache2::Connection object )".PD 0.ie n .IP "opt arg1: $new_notes\fR ( \f(CW""APR::Table object"" )" 4.el .IP "opt arg1: \f(CW$new_notes\fR ( \f(CWAPR::Table object\fR )" 4.IX Item "opt arg1: $new_notes ( APR::Table object )".ie n .IP "ret: $notes\fR ( \f(CW""APR::Table object"" )" 4.el .IP "ret: \f(CW$notes\fR ( \f(CWAPR::Table object\fR )" 4.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".PPAlso see\&\f(CW\*(C`$r\->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 protocol level outputfilters:.PP.Vb 2\&  $output_filters = $c\->output_filters();\&  $prev_output_filters = $r\->output_filters($new_output_filters);.Ve.ie n .IP "obj: $c\fR ( \f(CW""Apache2::Connection object"" )" 4.el .IP "obj: \f(CW$c\fR ( \f(CWApache2::Connection object\fR )" 4.IX Item "obj: $c ( Apache2::Connection 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 connection 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 an example see: Bucket Brigades-based ProtocolModule.ie n .Sh """pool""".el .Sh "\f(CWpool\fP".IX Subsection "pool"Pool associated with this connection.PP.Vb 1\&  $p = $c\->pool();.Ve.ie n .IP "obj: $c\fR ( \f(CW""Apache2::Connection object"" )" 4.el .IP "obj: \f(CW$c\fR ( \f(CWApache2::Connection object\fR )" 4.IX Item "obj: $c ( Apache2::Connection 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 """remote_addr""".el .Sh "\f(CWremote_addr\fP".IX Subsection "remote_addr"Get this connection's remote socket address.PP.Vb 1\&  $remote_sa = $c\->remote_addr();.Ve.ie n .IP "obj: $c\fR ( \f(CW""Apache2::Connection object"" )" 4.el .IP "obj: \f(CW$c\fR ( \f(CWApache2::Connection object\fR )" 4.IX Item "obj: $c ( Apache2::Connection object )".PD 0.ie n .IP "ret: $remote_sa\fR ( \f(CW""APR::SockAddr object"" )" 4.el .IP "ret: \f(CW$remote_sa\fR ( \f(CWAPR::SockAddr object\fR )" 4.IX Item "ret: $remote_sa ( APR::SockAddr object )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.ie n .Sh """remote_ip""".el .Sh "\f(CWremote_ip\fP".IX Subsection "remote_ip"Client's \s-1IP\s0 address.PP.Vb 2\&  $remote_ip      = $c\->remote_ip();\&  $prev_remote_ip = $c\->remote_ip($new_remote_ip);.Ve.ie n .IP "obj: $c\fR ( \f(CW""Apache2::Connection object"" )" 4.el .IP "obj: \f(CW$c\fR ( \f(CWApache2::Connection object\fR )" 4.IX Item "obj: $c ( Apache2::Connection object )".PD 0.ie n .IP "opt arg1: $new_remote_ip ( string )" 4.el .IP "opt arg1: \f(CW$new_remote_ip\fR ( string )" 4.IX Item "opt arg1: $new_remote_ip ( string )".PDIf passed a new value will be set.ie n .IP "ret: $remote_ip ( string )" 4.el .IP "ret: \f(CW$remote_ip\fR ( string )" 4.IX Item "ret: $remote_ip ( string )"current remote ip address.Spif the optional argument \f(CW$new_remote_ip\fR was passed the previousvalue is returned..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".ie n .Sh """remote_host""".el .Sh "\f(CWremote_host\fP".IX Subsection "remote_host"Client's \s-1DNS\s0 name:.PP.Vb 1\&  $remote_host = $c\->remote_host();.Ve.ie n .IP "obj: $c\fR ( \f(CW""Apache2::Connection object"" )" 4.el .IP "obj: \f(CW$c\fR ( \f(CWApache2::Connection object\fR )" 4.IX Item "obj: $c ( Apache2::Connection object )".PD 0.ie n .IP "ret: $remote_host ( string/undef )" 4.el .IP "ret: \f(CW$remote_host\fR ( string/undef )" 4.IX Item "ret: $remote_host ( string/undef )".PDIf \f(CW\*(C`$c\->get_remote_host\*(C'\fR was run itreturns the cached value, which is a client \s-1DNS\s0 name or \f(CW""\fR if itwasn't found. If the check wasn't run \*(-- \f(CW\*(C`undef\*(C'\fR is returned..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPIt's best to to call \f(CW\*(C`$c\->get_remote_host\*(C'\fRinstead of directly accessing this variable..SH "Unsupported API".IX Header "Unsupported API"\&\f(CW\*(C`Apache2::Connection\*(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 """conn_config""".el .Sh "\f(CWconn_config\fP".IX Subsection "conn_config"Config vector containing pointers to connections per-server configstructures.PP.Vb 1\&  $ret = $c\->conn_config();.Ve.ie n .IP "obj: $c\fR ( \f(CW""Apache2::Connection object"" )" 4.el .IP "obj: \f(CW$c\fR ( \f(CWApache2::Connection object\fR )" 4.IX Item "obj: $c ( Apache2::Connection object )".PD 0.ie n .IP "ret: $ret\fR ( \f(CW""Apache2::ConfVector object"" )" 4.el .IP "ret: \f(CW$ret\fR ( \f(CWApache2::ConfVector object\fR )" 4.IX Item "ret: $ret ( Apache2::ConfVector object )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.ie n .Sh """sbh""".el .Sh "\f(CWsbh\fP".IX Subsection "sbh"\&\s-1META:\s0 Autogenerated \- needs to be reviewed/completed.PPhandle to scoreboard information for this connection.PP.Vb 1\&  $sbh = $c\->sbh();.Ve.ie n .IP "obj: $c\fR ( \f(CW""Apache2::Connection object"" )" 4.el .IP "obj: \f(CW$c\fR ( \f(CWApache2::Connection object\fR )" 4.IX Item "obj: $c ( Apache2::Connection object )".PD 0.ie n .IP "ret: $sbh (\s-1XXX\s0)" 4.el .IP "ret: \f(CW$sbh\fR (\s-1XXX\s0)" 4.IX Item "ret: $sbh (XXX)".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PP\&\s-1META:\s0 Not sure how this can be used from mod_perl at themoment. Unless \f(CW\*(C`Apache2::Scoreboard\*(C'\fR is extended to provide a hook toread from this variable..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 + =
减小字号Ctrl + -
显示快捷键?