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

📄 requestrec.pm

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 PM
📖 第 1 页 / 共 3 页
字号:
# # /*#  * *********** WARNING **************#  * This file generated by ModPerl::WrapXS/0.01#  * Any changes made here will be lost#  * ***********************************#  * 01: lib/ModPerl/Code.pm:708#  * 02: lib/ModPerl/WrapXS.pm:624#  * 03: lib/ModPerl/WrapXS.pm:1173#  * 04: Makefile.PL:423#  * 05: Makefile.PL:325#  * 06: Makefile.PL:56#  */# package Apache2::RequestRec;use strict;use warnings FATAL => 'all';use Apache2::XSLoader ();our $VERSION = '2.000002';Apache2::XSLoader::load __PACKAGE__;1;__END__=head1 NAMEApache2::RequestRec - Perl API for Apache request record accessors=head1 Synopsis  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('text/plain');    # special response headers table  $err_headers_out = $r->err_headers_out();    # request mapped filename  $filename = $r->filename();    # request finfo  $finfo = $r->finfo();    # 'SetHandler perl-script' equivalent  $r->handler('perl-script');    # 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's the current request (GET/POST/etc)?  $method = $r->method();    # what's 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();=head1 DescriptionC<Apache2::RequestRec> provides the Perl API for Apache request_recobject.The following packages extend the C<Apache2::RequestRec> functionality:C<L<Apache2::Access|docs::2.0::api::Apache2::Access>>,C<L<Apache2::Log|docs::2.0::api::Apache2::Log>>,C<L<Apache2::RequestIO|docs::2.0::api::Apache2::RequestIO>>,C<L<Apache2::RequestUtil|docs::2.0::api::Apache2::RequestUtil>>,C<L<Apache2::Response|docs::2.0::api::Apache2::Response>>,C<L<Apache2::SubRequest|docs::2.0::api::Apache2::SubRequest>> andC<L<Apache2::URI|docs::2.0::api::Apache2::URI>>.=head1 APIC<Apache2::RequestRec> provides the following functions and/or methods:=head2 C<allowed>Get/set the allowed methods bitmask.  $allowed      = $r->allowed();  $prev_allowed = $r->allowed($new_allowed);=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )=item opt arg1: C<$new_allowed> ( bitmask )Set the bitvector.=item ret: C<$allowed> ( bitmask )returns C<$allowed>, which is a bitvector of the allowed methods.If the C<$new_allowed> argument is passed, the value before the changeis returned.=item since: 2.0.00=backA handler must ensure that the request method is one that it iscapable of handling.  Generally modules should C<Apache2::DECLINE> anyrequest methods they do not handle.  Prior to aborting the handlerlike this the handler should set C<$r-E<gt>allowed> to the list ofmethods that it is willing to handle.  This bitvector is used toconstruct the C<"Allow:"> header required for C<OPTIONS> requests, andC<Apache2::Const::HTTP_METHOD_NOT_ALLOWED> (405) andC<Apache2::Const::HTTP_NOT_IMPLEMENTED> (501) status codes.Since the default Apache handler deals with the C<OPTIONS> method, allresponse handlers can usually decline to deal with C<OPTIONS>. Forexample if the response handler handles only C<GET> and C<POST>methods, and not C<OPTIONS>, it may want to say:   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;   }C<TRACE> is always allowed, modules don't need to set it explicitly.Since the default_handler will always handle a C<GET>, a module whichdoes *not* implement C<GET> should probably returnC<Apache2::Const::HTTP_METHOD_NOT_ALLOWED>.  Unfortunately this means that ascript C<GET> handler can't be installed by mod_actions.For example, if the module can handle only POST method it could startwith:   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;   }=head2 C<ap_auth_type>If an authentication check was made, get or set the I<ap_auth_type>slot in the request record  $auth_type = $r->ap_auth_type();  $r->ap_auth_type($newval);=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )=item opt arg1: C<$newval> (string)If this argument is passed then a new auth type is assigned. For example:  $r->auth_type('Basic');=item ret: C<$auth_type> (string)If C<$newval> is passed, nothing is returned. Otherwise the currentauth type is returned.=item since: 2.0.00=backI<ap_auth_type> holds the authentication type that has been negotiatedbetween the client and server during the actual request.  Generally,I<ap_auth_type> is populated automatically when you callC<$r-E<gt>get_basic_auth_pw> 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 I<ap_auth_type> yourself.Note that C<$r-E<gt>ap_auth_type> wasC<$r-E<gt>connection-E<gt>auth_type> in the mod_perl 1.0 API.=head2 C<args>Get/set the request QUERY string  $args      = $r->args();  $prev_args = $r->args($new_args);=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )=item opt arg1: C<$new_args> ( string )Optinally set the new QUERY string=item ret: C<$args> ( string )The current QUERY stringIf C<$new_args> was passed, returns the value before the change.=item since: 2.0.00=back=head2 C<assbackwards>When set to a true value, Apache won't send any HTTP response headersallowing you to send any headers.  $status      = $r->assbackwards();  $prev_status = $r->assbackwards($newval);=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )=item opt arg1: C<$newval> (integer)assign a new state.=item ret: C<$status> (integer)current state.=item since: 2.0.00=backIf you send your own set of headers, which includes the C<Keep-Alive>HTTP response header, you must make sure to increment the number ofrequests served over this connection (which is normally done by thecore connection output filter C<ap_http_header_filter>, but skippedwhen C<assbackwards> is enabled).  $r->connection->keepalives($r->connection->keepalives + 1);otherwise code relying on the value ofC<L<$r-E<gt>connection-E<gt>keepalives|docs::2.0::api::Apache2::Connection/C_keepalives_>>may 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 HTTP headers (likeC<Apache2::Filter::HTTPHeadersFixup>). Of course you will need to setC<L<$r-E<gt>connection-E<gt>keepalive(1)|docs::2.0::api::Apache2::Connection/C_keepalive_>>) as well.=head2 C<bytes_sent>The number of bytes sent to the client, handy for logging, etc.  $bytes_sent = $r->bytes_sent();=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )=item ret: C<$bytes_sent> (integer)=item since: 2.0.00=backThough 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 "bytes sent to the network for this response".=head2 C<connection>Get the client connection record  $c = $r->connection();=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )=item ret: C<$c>( C<L<Apache2::Connection object|docs::2.0::api::Apache2::Connection>> )=item since: 2.0.00=back=head2 C<content_encoding>Get/set content encoding (the "Content-Encoding" HTTP header).Content encodings are string like I<"gzip"> or I<"compress">.  $ce      = $r->content_encoding();  $prev_ce = $r->content_encoding($new_ce);=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )=item opt arg1: C<$new_ce> ( string )If passed, sets the content encoding to a new value. It must be alowercased string.=item ret: C<$ce> ( string )The current content encoding.If C<$new_ce> is passed, then the previous value is returned.=item since: 2.0.00=backFor example, here is how to send a gzip'ed response:  require Compress::Zlib;  $r->content_type("text/plain");  $r->content_encoding("gzip");  $r->print(Compress::Zlib::memGzip("some text to be gzipped));=head2 C<content_languages>Get/set content languages (the C<"Content-Language"> HTTP header).Content languages are string like I<"en"> or I<"fr">.  $languages = $r->content_languages();  $prev_lang = $r->content_languages($nev_lang);=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )=item opt arg1: C<$new_lang> ( ARRAY ref )If passed, sets the content languages to new values. It must be anARRAY reference of language names, like I<"en"> or I<"fr">=item ret: C<$languages> ( ARRAY ref )The current list of content languages, as an ARRAY reference.If C<$new_lang> is passed, then the previous value is returned.=item since: 2.0.00=back=head2 C<content_type>Get/set the HTTP response I<Content-type> header value.  my $content_type      = $r->content_type();  my $prev_content_type = $r->content_type($new_content_type);=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )=item opt arg1: C<$new_content_type> (MIME type string)Assign a new HTTP response content-type. It will affect the responseonly if HTTP headers weren't sent yet.=item ret: C<$content_type>The current content-type value.If C<$new_content_type> was passed, the previous value is returnedinstead.=item since: 2.0.00=backFor example, set the C<Content-type> header to I<text/plain>.  $r->content_type('text/plain');If you set this header via theC<L<headers_out|docs::2.0::api::Apache2::RequestRec/C_headers_out_>>table directly, it will be ignored by Apache. So do not do that.=head2 C<err_headers_out>Get/set MIME response headers, printed even on errors and persistacross internal redirects.  $err_headers_out = $r->err_headers_out();=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )=item ret: C<$err_headers_out>( C<L<APR::Table object|docs::2.0::api::APR::Table>> )=item since: 2.0.00=backThe difference between C<L<headers_out|/C_headers_out_>> andC<err_headers_out>, is that the latter are printed even on error, andpersist across internal redirects (so the headers printed forC<ErrorDocument> handlers will have them).For example, if a handler wants to return a 404 response, butnevertheless to set a cookie, it has to be:  $r->err_headers_out->add('Set-Cookie' => $cookie);  return Apache2::Const::NOT_FOUND;If the handler does:  $r->headers_out->add('Set-Cookie' => $cookie);  return Apache2::Const::NOT_FOUND;the C<Set-Cookie> header won't be sent.=head2 C<filename>Get/set the filename on disk corresponding to this response (theresult of the I<URI --E<gt> filename> translation).  $filename      = $r->filename();  $prev_filename = $r->filename($new_filename);=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )=item opt arg1: C<$new_filename> ( string )new value=item ret: C<$filename> ( string )the current filename, or the previous value if the optionalC<$new_filename> argument was passed=item since: 2.0.00=backNote that if you change the filename after theC<L<PerlMapToStorageHandler|docs::2.0::user::handlers::http/PerlMapToStorageHandler>>phase was run and expect Apache to serve it, you need to update itsC<stat> record, like so:  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));if you don't, Apache will still try to use the previously cachedinformation about the previously set value of the filename.=head2 C<finfo>Get and set the I<finfo> request record member:  $finfo = $r->finfo();  $r->finfo($finfo);=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )=item opt arg1: C<$finfo>( C<L<APR::Finfo object|docs::2.0::api::APR::Finfo>> )=item ret: C<$finfo>( C<L<APR::Finfo object|docs::2.0::api::APR::Finfo>> )Always returns the current object.Due to the internal Apache implementation it's not possible to havetwo different objects originating from C<$r-E<gt>finfo> at the sametime. Whenever C<$r-E<gt>finfo> is updated all objects will be updated

⌨️ 快捷键说明

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