📄 apache2::requestrec.3
字号:
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" Standard preamble:.\" ========================================================================.de Sh \" Subsection heading.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Vb \" Begin verbatim text.ft CW.nf.ne \\$1...de Ve \" End verbatim text.ft R.fi...\" Set up some character translations and predefined strings. \*(-- will.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left.\" double quote, and \*(R" will give a right double quote. \*(C+ will.\" give a nicer C++. Capital omega is used to do unbreakable dashes and.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,.\" nothing in troff, for use with C<>..tr \(*W-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'.ie n \{\. ds -- \(*W-. ds PI pi. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch. ds L" "". ds R" "". ds C` "". ds C' ""'br\}.el\{\. ds -- \|\(em\|. ds PI \(*p. ds L" ``. ds R" '''br\}.\".\" Escape single quotes in literal strings from groff's Unicode transform..ie \n(.g .ds Aq \(aq.el .ds Aq '.\".\" If the F register is turned on, we'll generate index entries on stderr for.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index.\" entries marked with X<> in POD. Of course, you'll have to process the.\" output yourself in some meaningful fashion..ie \nF \{\. de IX. tm Index:\\$1\t\\n%\t"\\$2"... nr % 0. rr F.\}.el \{\. de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear. Run. Save yourself. No user-serviceable parts.. \" fudge factors for nroff and troff.if n \{\. ds #H 0. ds #V .8m. ds #F .3m. ds #[ \f1. ds #] \fP.\}.if t \{\. ds #H ((1u-(\\\\n(.fu%2u))*.13m). ds #V .6m. ds #F 0. ds #[ \&. ds #] \&.\}. \" simple accents for nroff and troff.if n \{\. ds ' \&. ds ` \&. ds ^ \&. ds , \&. ds ~ ~. ds /.\}.if t \{\. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u". ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}. \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E. \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'. \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\. ds : e. ds 8 ss. ds o a. ds d- d\h'-1'\(ga. ds D- D\h'-1'\(hy. ds th \o'bp'. ds Th \o'LP'. ds ae ae. ds Ae AE.\}.rm #[ #] #H #V #F C.\" ========================================================================.\".IX Title "mod_perl-2.0.2::docs::api::Apache2::RequestRec 3".TH mod_perl-2.0.2::docs::api::Apache2::RequestRec 3 "2005-10-21" "perl v5.10.0" "User Contributed Perl Documentation".\" For nroff, turn off justification. Always turn off hyphenation; it makes.\" way too many mistakes in technical documents..if n .ad l.nh.SH "NAME"Apache2::RequestRec \- Perl API for Apache request record accessors.SH "Synopsis".IX Header "Synopsis".Vb 1\& use Apache2::RequestRec ();\& \& # set supported by the handler HTTP methods\& $allowed = $r\->allowed();\& \& # auth type\& $auth_type = $r\->ap_auth_type();\& \& # QUERY_STRING\& $args = $r\->args();\& \& # non\-parsed\-headers handler\& $status = $r\->assbackwards();\& \& # how many bytes were sent\& $bytes_sent = $r\->bytes_sent();\& \& # client connection record\& $c = $r\->connection();\& \& # "Content\-Encoding" HTTP response header\& $r\->content_encoding("gzip");\& \& # the languages of the content\& $languages = $r\->content_languages();\& \& # "Content\-Encoding" HTTP response header\& $r\->content_type(\*(Aqtext/plain\*(Aq);\& \& # special response headers table\& $err_headers_out = $r\->err_headers_out();\& \& # request mapped filename\& $filename = $r\->filename();\& \& # request finfo\& $finfo = $r\->finfo();\& \& # \*(AqSetHandler perl\-script\*(Aq equivalent\& $r\->handler(\*(Aqperl\-script\*(Aq);\& \& # was it a HEAD request?\& $status = $r\->header_only();\& \& # request input headers table\& $headers_in = $r\->headers_in();\& \& # request output headers table\& $headers_out = $r\->headers_out();\& \& # hostname\& $hostname = $r\->hostname();\& \& # input filters stack\& $input_filters = $r\->input_filters();\& \& # get the main request obj in a sub\-request\& $main_r = $r\->main();\& \& # what\*(Aqs the current request (GET/POST/etc)?\& $method = $r\->method();\& \& # what\*(Aqs the current method number?\& $methnum = $r\->method_number();\& \& # current resource last modified time\& $mtime = $r\->mtime();\& \& # next request object (in redirect)\& $next_r = $r\->next();\& \& # there is no local copy\& $r\->no_local_copy();\& \& # Apache ascii notes table\& $notes = $r\->notes();\& \& # output filters stack\& $output_filters = $r\->output_filters();\& \& # PATH_INFO\& $path_info = $r\->path_info();\& \& # used in configuration directives modules\& $per_dir_config = $r\->per_dir_config();\& \& # pool with life span of the current request\& $p = $r\->pool();\& \& # previous request object in the internal redirect\& $prev_r = $r\->prev();\& \& # connection level input filters stack\& $proto_input_filters = $r\->proto_input_filters();\& \& # HTTP protocol version number\& $proto_num = $r\->proto_num();\& \& # connection level output filters stack\& $proto_output_filters = $r\->proto_output_filters();\& \& # the protocol, the client speaks: "HTTP/1.0", "HTTP/1.1", etc.\& $protocol = $r\->protocol();\& \& # is it a proxy request\& $status = $r\->proxyreq($val);\& \& # Time when the request started\& $request_time = $r\->request_time();\& \& # server object\& $s = $r\->server();\& \& # response status\& $status = $r\->status();\& \& # response status line\& $status_line = $r\->status_line();\& \& # manipulate %ENV of the subprocess\& $r\->subprocess_env;\& $r\->subprocess_env($key => $val);\& \& # first HTTP request header\& $request = $r\->the_request();\& \& # the URI without any parsing performed\& $unparsed_uri = $r\->unparsed_uri();\& \& # The path portion of the URI\& $uri = $r\->uri();\& \& # auth username\& $user = $r\->user();.Ve.SH "Description".IX Header "Description"\&\f(CW\*(C`Apache2::RequestRec\*(C'\fR provides the Perl \s-1API\s0 for Apache request_recobject..PPThe following packages extend the \f(CW\*(C`Apache2::RequestRec\*(C'\fR functionality:\&\f(CW\*(C`Apache2::Access\*(C'\fR,\&\f(CW\*(C`Apache2::Log\*(C'\fR,\&\f(CW\*(C`Apache2::RequestIO\*(C'\fR,\&\f(CW\*(C`Apache2::RequestUtil\*(C'\fR,\&\f(CW\*(C`Apache2::Response\*(C'\fR,\&\f(CW\*(C`Apache2::SubRequest\*(C'\fR and\&\f(CW\*(C`Apache2::URI\*(C'\fR..SH "API".IX Header "API"\&\f(CW\*(C`Apache2::RequestRec\*(C'\fR provides the following functions and/or methods:.ie n .Sh """allowed""".el .Sh "\f(CWallowed\fP".IX Subsection "allowed"Get/set the allowed methods bitmask..PP.Vb 2\& $allowed = $r\->allowed();\& $prev_allowed = $r\->allowed($new_allowed);.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_allowed ( bitmask )" 4.el .IP "opt arg1: \f(CW$new_allowed\fR ( bitmask )" 4.IX Item "opt arg1: $new_allowed ( bitmask )".PDSet the bitvector..ie n .IP "ret: $allowed ( bitmask )" 4.el .IP "ret: \f(CW$allowed\fR ( bitmask )" 4.IX Item "ret: $allowed ( bitmask )"returns \f(CW$allowed\fR, which is a bitvector of the allowed methods..SpIf the \f(CW$new_allowed\fR argument is passed, the value before the changeis returned..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPA handler must ensure that the request method is one that it iscapable of handling. Generally modules should \f(CW\*(C`Apache2::DECLINE\*(C'\fR anyrequest methods they do not handle. Prior to aborting the handlerlike this the handler should set \f(CW\*(C`$r\->allowed\*(C'\fR to the list ofmethods that it is willing to handle. This bitvector is used toconstruct the \f(CW"Allow:"\fR header required for \f(CW\*(C`OPTIONS\*(C'\fR requests, and\&\f(CW\*(C`Apache2::Const::HTTP_METHOD_NOT_ALLOWED\*(C'\fR (405) and\&\f(CW\*(C`Apache2::Const::HTTP_NOT_IMPLEMENTED\*(C'\fR (501) status codes..PPSince the default Apache handler deals with the \f(CW\*(C`OPTIONS\*(C'\fR method, allresponse handlers can usually decline to deal with \f(CW\*(C`OPTIONS\*(C'\fR. Forexample if the response handler handles only \f(CW\*(C`GET\*(C'\fR and \f(CW\*(C`POST\*(C'\fRmethods, and not \f(CW\*(C`OPTIONS\*(C'\fR, it may want to say:.PP.Vb 5\& use Apache2::Const \-compile => qw(OK DECLINED M_GET M_POST M_OPTIONS);\& if ($r\->method_number == Apache2::Const::M_OPTIONS) {\& $r\->allowed($r\->allowed | (1<<Apache2::Const::M_GET) | (1<<Apache2::Const::M_POST));\& return Apache2::Const::DECLINED;\& }.Ve.PP\&\f(CW\*(C`TRACE\*(C'\fR is always allowed, modules don't need to set it explicitly..PPSince the default_handler will always handle a \f(CW\*(C`GET\*(C'\fR, a module whichdoes *not* implement \f(CW\*(C`GET\*(C'\fR should probably return\&\f(CW\*(C`Apache2::Const::HTTP_METHOD_NOT_ALLOWED\*(C'\fR. Unfortunately this means that ascript \f(CW\*(C`GET\*(C'\fR handler can't be installed by mod_actions..PPFor example, if the module can handle only \s-1POST\s0 method it could startwith:.PP.Vb 5\& use Apache2::Const \-compile => qw(M_POST HTTP_METHOD_NOT_ALLOWED);\& unless ($r\->method_number == Apache2::Const::M_POST) {\& $r\->allowed($r\->allowed | (1<<Apache2::Const::M_POST));\& return Apache2::Const::HTTP_METHOD_NOT_ALLOWED;\& }.Ve.ie n .Sh """ap_auth_type""".el .Sh "\f(CWap_auth_type\fP".IX Subsection "ap_auth_type"If an authentication check was made, get or set the \fIap_auth_type\fRslot in the request record.PP.Vb 2\& $auth_type = $r\->ap_auth_type();\& $r\->ap_auth_type($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 (string)" 4
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -