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

📄 apache2::requestrec.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 5 页
字号:
.el .IP "opt arg1: \f(CW$newval\fR (string)" 4.IX Item "opt arg1: $newval (string)".PDIf this argument is passed then a new auth type is assigned. For example:.Sp.Vb 1\&  $r\->auth_type(\*(AqBasic\*(Aq);.Ve.ie n .IP "ret: $auth_type (string)" 4.el .IP "ret: \f(CW$auth_type\fR (string)" 4.IX Item "ret: $auth_type (string)"If \f(CW$newval\fR is passed, nothing is returned. Otherwise the currentauth type is returned..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PP\&\fIap_auth_type\fR holds the authentication type that has been negotiatedbetween the client and server during the actual request.  Generally,\&\fIap_auth_type\fR is populated automatically when you call\&\f(CW\*(C`$r\->get_basic_auth_pw\*(C'\fR so you don't really need to worry toomuch about it, but if you want to roll your own authenticationmechanism then you will have to populate \fIap_auth_type\fR yourself..PPNote that \f(CW\*(C`$r\->ap_auth_type\*(C'\fR was\&\f(CW\*(C`$r\->connection\->auth_type\*(C'\fR in the mod_perl 1.0 \s-1API\s0..ie n .Sh """args""".el .Sh "\f(CWargs\fP".IX Subsection "args"Get/set the request \s-1QUERY\s0 string.PP.Vb 2\&  $args      = $r\->args();\&  $prev_args = $r\->args($new_args);.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_args ( string )" 4.el .IP "opt arg1: \f(CW$new_args\fR ( string )" 4.IX Item "opt arg1: $new_args ( string )".PDOptinally set the new \s-1QUERY\s0 string.ie n .IP "ret: $args ( string )" 4.el .IP "ret: \f(CW$args\fR ( string )" 4.IX Item "ret: $args ( string )"The current \s-1QUERY\s0 string.SpIf \f(CW$new_args\fR was passed, returns the value before the change..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".ie n .Sh """assbackwards""".el .Sh "\f(CWassbackwards\fP".IX Subsection "assbackwards"When set to a true value, Apache won't send any \s-1HTTP\s0 response headersallowing you to send any headers..PP.Vb 2\&  $status      = $r\->assbackwards();\&  $prev_status = $r\->assbackwards($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 (integer)" 4.el .IP "opt arg1: \f(CW$newval\fR (integer)" 4.IX Item "opt arg1: $newval (integer)".PDassign a new state..ie n .IP "ret: $status (integer)" 4.el .IP "ret: \f(CW$status\fR (integer)" 4.IX Item "ret: $status (integer)"current state..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPIf you send your own set of headers, which includes the \f(CW\*(C`Keep\-Alive\*(C'\fR\&\s-1HTTP\s0 response header, you must make sure to increment the number ofrequests served over this connection (which is normally done by thecore connection output filter \f(CW\*(C`ap_http_header_filter\*(C'\fR, but skippedwhen \f(CW\*(C`assbackwards\*(C'\fR is enabled)..PP.Vb 1\&  $r\->connection\->keepalives($r\->connection\->keepalives + 1);.Ve.PPotherwise code relying on the value of\&\f(CW\*(C`$r\->connection\->keepalives\*(C'\fRmay malfunction. For example, this counter is used to tell when a newrequest is coming in over the same connection to a filter that wantsto parse only \s-1HTTP\s0 headers (like\&\f(CW\*(C`Apache2::Filter::HTTPHeadersFixup\*(C'\fR). Of course you will need to set\&\f(CW\*(C`$r\->connection\->keepalive(1)\*(C'\fR) as well..ie n .Sh """bytes_sent""".el .Sh "\f(CWbytes_sent\fP".IX Subsection "bytes_sent"The number of bytes sent to the client, handy for logging, etc..PP.Vb 1\&  $bytes_sent = $r\->bytes_sent();.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: $bytes_sent (integer)" 4.el .IP "ret: \f(CW$bytes_sent\fR (integer)" 4.IX Item "ret: $bytes_sent (integer)".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PPThough as of this writing in Apache 2.0 it doesn't really do what itdid in Apache 1.3. It's just set to the size of the response body.The issue is that buckets from one request may get buffered and notsent during the lifetime of the request, so it's not easy to give atruly accurate count of \*(L"bytes sent to the network for this response\*(R"..ie n .Sh """connection""".el .Sh "\f(CWconnection\fP".IX Subsection "connection"Get the client connection record.PP.Vb 1\&  $c = $r\->connection();.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: $c\fR ( \f(CW""Apache2::Connection object"" )" 4.el .IP "ret: \f(CW$c\fR ( \f(CWApache2::Connection object\fR )" 4.IX Item "ret: $c ( Apache2::Connection object )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.ie n .Sh """content_encoding""".el .Sh "\f(CWcontent_encoding\fP".IX Subsection "content_encoding"Get/set content encoding (the \*(L"Content-Encoding\*(R" \s-1HTTP\s0 header).Content encodings are string like \fI\*(L"gzip\*(R"\fR or \fI\*(L"compress\*(R"\fR..PP.Vb 2\&  $ce      = $r\->content_encoding();\&  $prev_ce = $r\->content_encoding($new_ce);.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_ce ( string )" 4.el .IP "opt arg1: \f(CW$new_ce\fR ( string )" 4.IX Item "opt arg1: $new_ce ( string )".PDIf passed, sets the content encoding to a new value. It must be alowercased string..ie n .IP "ret: $ce ( string )" 4.el .IP "ret: \f(CW$ce\fR ( string )" 4.IX Item "ret: $ce ( string )"The current content encoding..SpIf \f(CW$new_ce\fR is passed, then the previous value is returned..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPFor example, here is how to send a gzip'ed response:.PP.Vb 4\&  require Compress::Zlib;\&  $r\->content_type("text/plain");\&  $r\->content_encoding("gzip");\&  $r\->print(Compress::Zlib::memGzip("some text to be gzipped));.Ve.ie n .Sh """content_languages""".el .Sh "\f(CWcontent_languages\fP".IX Subsection "content_languages"Get/set content languages (the \f(CW"Content\-Language"\fR \s-1HTTP\s0 header).Content languages are string like \fI\*(L"en\*(R"\fR or \fI\*(L"fr\*(R"\fR..PP.Vb 2\&  $languages = $r\->content_languages();\&  $prev_lang = $r\->content_languages($nev_lang);.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_lang ( \s-1ARRAY\s0 ref )" 4.el .IP "opt arg1: \f(CW$new_lang\fR ( \s-1ARRAY\s0 ref )" 4.IX Item "opt arg1: $new_lang ( ARRAY ref )".PDIf passed, sets the content languages to new values. It must be an\&\s-1ARRAY\s0 reference of language names, like \fI\*(L"en\*(R"\fR or \fI\*(L"fr\*(R"\fR.ie n .IP "ret: $languages ( \s-1ARRAY\s0 ref )" 4.el .IP "ret: \f(CW$languages\fR ( \s-1ARRAY\s0 ref )" 4.IX Item "ret: $languages ( ARRAY ref )"The current list of content languages, as an \s-1ARRAY\s0 reference..SpIf \f(CW$new_lang\fR is passed, then the previous value is returned..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".ie n .Sh """content_type""".el .Sh "\f(CWcontent_type\fP".IX Subsection "content_type"Get/set the \s-1HTTP\s0 response \fIContent-type\fR header value..PP.Vb 2\&  my $content_type      = $r\->content_type();\&  my $prev_content_type = $r\->content_type($new_content_type);.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_content_type (\s-1MIME\s0 type string)" 4.el .IP "opt arg1: \f(CW$new_content_type\fR (\s-1MIME\s0 type string)" 4.IX Item "opt arg1: $new_content_type (MIME type string)".PDAssign a new \s-1HTTP\s0 response content-type. It will affect the responseonly if \s-1HTTP\s0 headers weren't sent yet..ie n .IP "ret: $content_type" 4.el .IP "ret: \f(CW$content_type\fR" 4.IX Item "ret: $content_type"The current content-type value..SpIf \f(CW$new_content_type\fR was passed, the previous value is returnedinstead..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPFor example, set the \f(CW\*(C`Content\-type\*(C'\fR header to \fItext/plain\fR..PP.Vb 1\&  $r\->content_type(\*(Aqtext/plain\*(Aq);.Ve.PPIf you set this header via the\&\f(CW\*(C`headers_out\*(C'\fRtable directly, it will be ignored by Apache. So do not do that..ie n .Sh """err_headers_out""".el .Sh "\f(CWerr_headers_out\fP".IX Subsection "err_headers_out"Get/set \s-1MIME\s0 response headers, printed even on errors and persistacross internal redirects..PP.Vb 1\&  $err_headers_out = $r\->err_headers_out();.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: $err_headers_out\fR ( \f(CW""APR::Table object"" )" 4.el .IP "ret: \f(CW$err_headers_out\fR ( \f(CWAPR::Table object\fR )" 4.IX Item "ret: $err_headers_out ( APR::Table object )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PPThe difference between \f(CW\*(C`headers_out\*(C'\fR and\&\f(CW\*(C`err_headers_out\*(C'\fR, is that the latter are printed even on error, andpersist across internal redirects (so the headers printed for\&\f(CW\*(C`ErrorDocument\*(C'\fR handlers will have them)..PPFor example, if a handler wants to return a 404 response, butnevertheless to set a cookie, it has to be:.PP.Vb 2\&  $r\->err_headers_out\->add(\*(AqSet\-Cookie\*(Aq => $cookie);\&  return Apache2::Const::NOT_FOUND;.Ve.PPIf the handler does:.PP.Vb 2\&  $r\->headers_out\->add(\*(AqSet\-Cookie\*(Aq => $cookie);\&  return Apache2::Const::NOT_FOUND;.Ve.PPthe \f(CW\*(C`Set\-Cookie\*(C'\fR header won't be sent..ie n .Sh """filename""".el .Sh "\f(CWfilename\fP".IX Subsection "filename"Get/set the filename on disk corresponding to this response (theresult of the \fI\s-1URI\s0 \-\-> filename\fR translation)..PP.Vb 2\&  $filename      = $r\->filename();\&  $prev_filename = $r\->filename($new_filename);.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_filename ( string )" 4.el .IP "opt arg1: \f(CW$new_filename\fR ( string )" 4.IX Item "opt arg1: $new_filename ( string )".PDnew value.ie n .IP "ret: $filename ( string )" 4.el .IP "ret: \f(CW$filename\fR ( string )" 4.IX Item "ret: $filename ( string )"the current filename, or the previous value if the optional\&\f(CW$new_filename\fR argument was passed.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPNote that if you change the filename after the\&\f(CW\*(C`PerlMapToStorageHandler\*(C'\fRphase was run and expect Apache to serve it, you need to update its\&\f(CW\*(C`stat\*(C'\fR record, like so:.PP.Vb 5\&  use Apache2::RequestRec ();\&  use APR::Finfo ();\&  use APR::Const \-compile => qw(FINFO_NORM);\&  $r\->filename($newfile);\&  $r\->finfo(APR::Finfo::stat($newfile, APR::Const::FINFO_NORM, $r\->pool));.Ve.PPif you don't, Apache will still try to use the previously cachedinformation about the previously set value of the filename..ie n .Sh """finfo""".el .Sh "\f(CWfinfo\fP".IX Subsection "finfo"Get and set the \fIfinfo\fR request record member:.PP.Vb 2\&  $finfo = $r\->finfo();\&  $r\->finfo($finfo);.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: $finfo\fR ( \f(CW""APR::Finfo object"" )" 4.el .IP "opt arg1: \f(CW$finfo\fR ( \f(CWAPR::Finfo object\fR )" 4.IX Item "opt arg1: $finfo ( APR::Finfo object )".ie n .IP "ret: $finfo\fR ( \f(CW""APR::Finfo object"" )" 4.el .IP "ret: \f(CW$finfo\fR ( \f(CWAPR::Finfo object\fR )" 4.IX Item "ret: $finfo ( APR::Finfo object )".PDAlways returns the current object..SpDue to the internal Apache implementation it's not possible to havetwo different objects originating from \f(CW\*(C`$r\->finfo\*(C'\fR at the sametime. Whenever \f(CW\*(C`$r\->finfo\*(C'\fR is updated all objects will be updatedtoo to the latest value..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPMost of the time, this method is used to get the \f(CW\*(C`finfo\*(C'\fR member. Theonly reason you may want to set it is you need to use it before theApache's default map_to_storage phase is called..PPExamples:.IP "\(bu" 4What Apache thinks is the current request filename (post the\&\f(CW\*(C`PerlMapToStorageHandler\*(C'\fRphase):.Sp.Vb 3\&  use Apache2::RequestRec ();\&  use APR::Finfo ();\&  print $r\->finfo\->fname;.Ve.IP "\(bu" 4Populate the \f(CW\*(C`finfo\*(C'\fR member (normally, before the\&\f(CW\*(C`PerlMapToStorageHandler\*(C'\fRphase):.Sp.Vb 2\&  use APR::Finfo ();\&  use APR::Const \-compile => qw(FINFO_NORM);\&  \&  my $finfo = APR::Finfo::stat(_\|_FILE_\|_, APR::Const::FINFO_NORM, $r\->pool);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -