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

📄 requestutil.pm

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 PM
📖 第 1 页 / 共 2 页
字号:
# # /*#  * *********** 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::RequestUtil;use strict;use warnings FATAL => 'all';use Apache2::XSLoader ();our $VERSION = '2.000002';Apache2::XSLoader::load __PACKAGE__;1;__END__=head1 NAMEApache2::RequestUtil - Perl API for Apache request record utils=head1 Synopsis  use Apache2::RequestUtil ();    # add httpd config dynamically  $r->add_config(['require valid-user']);    # dump the request object as a string  print $r->as_string();    # default content_type  $content_type = $r->default_type();    # get PerlSetVar/PerlAddVar values  @values = $r->dir_config->get($key);    # get server docroot  $docroot = $r->document_root();    # set server docroot  $r->document_root($new_root);    # what are the registered perl handlers for a given phase  my @handlers = @{ $r->get_handlers('PerlResponseHandler') || [] };    # push a new handler for a given phase  $r->push_handlers(PerlCleanupHandler => \&handler);    # set handlers for a given phase (resetting previous values)  $r->set_handlers(PerlCleanupHandler => []);    # what's the request body limit  $limit = $r->get_limit_req_body();    # server and port names  $server = $r->get_server_name();  $port   = $r->get_server_port();    # what string Apache is going to send for a given status code  $status_line = Apache2::RequestUtil::get_status_line(404);    # are we in the main request?  $is_initial = $r->is_initial_req();    # directory level PerlOptions flags lookup  $r->subprocess_env unless $r->is_perl_option_enabled('SetupEnv');    # current <Location> value  $location = $r->location();    # merge a <Location> container in a request object  $r->location_merge($location);    # create a new Apache2::RequestRec object  $r = Apache2::RequestRec->new($c);    # tell the client not to cache the response  $r->no_cache($boolean);    # share perl objects like $r->notes  $r->pnotes($key => [$obj1, $obj2]);    # get HTML signature  $sig = $r->psignature($prefix);    # get the global request object (requires PerlOptions +GlobalRequest)  $r = Apache2::RequestUtil->request;    # insert auth credentials into the request as if the client did that  $r->set_basic_credentials($username, $password);    # slurp the contents of $r->filename  my $content = ${ $r->slurp_filename() };    # terminate the current child after this request  $r->child_terminate();=head1 DescriptionC<Apache2::RequestUtil> provides the L<Apache requestobject|docs::2.0::api::Apache2::RequestRec> utilities API.=head1 API=head2 C<add_config>Dynamically add Apache configuration at request processing runtime:  $r->add_config($lines);  $r->add_config($lines, $override);=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )=item arg1: C<$lines> (ARRAY ref)An ARRAY reference containing configuration lines per element, withoutthe new line terminators.=item opt arg2: C<$override> ( C<L<APR::Const statusconstant|docs::2.0::api::APR::Const>> )Which allow-override bits are setDefault value is:C<L<Apache2::Const::OR_AUTHCFG|docs::2.0::api::Apache2::Const/C_Apache2__Const__OR_AUTHCFG_>>=item ret: no return value=item since: 2.0.00=backSee also:C<L<$s-E<gt>add_config|docs::2.0::api::Apache2::ServerUtil/C_add_config_>>For example:  use Apache2::ServerUtil ();  $r->add_config(['require valid-user']);=head2 C<as_string>Dump the request object as a string  $dump = $r->as_string();=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )=item ret: C<$dump> ( string )=item since: 2.0.00=backDumps various request and response headers (mainly useful fordebugging)=head2 C<child_terminate>Terminate the current worker process as soon as the current request isover  $r->child_terminate();=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )=item ret: no return value=item since: 2.0.00=backThis method is not supported in threaded MPMs=head2 C<default_type>Retrieve the value of the DefaultType directive for the currentrequest. If not set C<text/plain> is returned.  $content_type = $r->default_type();=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )The current request=item ret: C<$content_type> ( string )The default type=item since: 2.0.00=back=head2 C<dir_config>C<$r-E<gt>dir_config()> provides an interface for the per-directoryvariable specified by the C<PerlSetVar> and C<PerlAddVar> directives,and also can be manipulated via theC<L<APR::Table|docs::2.0::api::APR::Table>> methods.  $table  = $r->dir_config();  $value  = $r->dir_config($key);  @values = $r->dir_config->get($key);  $r->dir_config($key, $val);=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )=item opt arg2: C<$key> ( string )Key string=item opt arg3: C<$val> ( string )Value string=item ret: ...Depends on the passed arguments, see further discussion=item since: 2.0.00=backThe keys are case-insensitive.  $apr_table = $r->dir_config();dir_config() called in a scalar context without the C<$key> argumentreturns a I<HASH> reference blessed into theC<L<APR::Table|docs::2.0::api::APR::Table>> class. This object can bemanipulated via the C<L<APR::Table|docs::2.0::api::APR::Table>>methods. For available methods seethe C<L<APR::Table|docs::2.0::api::APR::Table>> manpage.  $value = $r->dir_config($key);If the C<$key> argument is passed in the scalar context only a singlevalue will be returned. Since the table preserves the insertion order,if there is more than one value for the same key, the oldest valueassosiated with the desired key is returned. Calling in the scalarcontext is also much faster, as it'll stop searching the table as soonas the first match happens.  @values = $r->dir_config->get($key);To receive a list of values you must use C<get()> method from theC<L<APR::Table|docs::2.0::api::APR::Table>> class.  $r->dir_config($key => $val);If the C<$key> and the C<$val> arguments are used, the set() operationwill happen: all existing values associated with the key C<$key> (andthe key itself) will be deleted and C<$value> will be placed instead.  $r->dir_config($key => undef);If C<$val> is I<undef> the unset() operation will happen: all existingvalues associated with the key C<$key> (and the key itself) will bedeleted.=head2 C<document_root>Retrieve the document root for this server  $docroot = $r->document_root();  $docroot = $r->document_root($new_root);=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )The current request=item opt arg1: C<$new_root>Sets the document root to a new value B<only for the duration of thecurrent request>.Note the L<limited functionality under threadedMPMs|docs::2.0::api::Apache2::ServerRec/Limited_Functionality_under_Threaded_MPMs>.=item ret: C<$docroot> ( string )The document root=item since: 2.0.00=back=head2 C<get_handlers>Returns a reference to a list of handlers enabled for a given phase.  $handlers_list = $r->get_handlers($hook_name);=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )=item arg1: C<$hook_name> ( string )a string representing the phase to handle (e.g. C<PerlLogHandler>)=item ret: C<$handlers_list> (ref to an ARRAY of CODE refs)a list of handler subroutines CODE references=item since: 2.0.00=backSee also:C<L<$s-E<gt>add_config|docs::2.0::api::Apache2::ServerUtil/C_get_handlers_>>For example:A list of handlers configured to run at the response phase:  my @handlers = @{ $r->get_handlers('PerlResponseHandler') || [] };=head2 C<get_limit_req_body>Return the limit on bytes in request msg body  $limit = $r->get_limit_req_body();=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )The current request=item ret: C<$limit> (integer)the maximum number of bytes in the request msg body=item since: 2.0.00=back=head2 C<get_server_name>Get the current request's server name  $server = $r->get_server_name();=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )The current request=item ret: C<$server> ( string )the server name=item since: 2.0.00=backFor example, consruct a hostport string:  use Apache2::RequestUtil ();  my $hostport = join ':', $r->get_server_name, $r->get_server_port;=head2 C<get_server_port>Get the current server port  $port = $r->get_server_port();=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )The current request=item ret: C<$port> ( integer )The server's port number=item since: 2.0.00=backFor example, consruct a hostport string:  use Apache2::RequestUtil ();  my $hostport = join ':', $r->get_server_name, $r->get_server_port;=head2 C<get_status_line>Return the C<Status-Line> for a given status code (excluding theHTTP-Version field).  $status_line = Apache2::RequestUtil::get_status_line($status);=over 4=item arg1: C<$status> (integer)The HTTP status code=item ret: C<$status_line> ( string )The Status-LineIf an invalid or unknown status code is passed, C<"500 Internal ServerError"> will be returned.=item since: 2.0.00=backFor example:  use Apache2::RequestUtil ();  print Apache2::RequestUtil::get_status_line(400);will print:  400 Bad Request=head2 C<is_initial_req>Determine whether the current request is the main request or asub-request  $is_initial = $r->is_initial_req();=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )A request or a sub-request object=item ret: C<$is_initial> ( boolean )If true -- it's the main request, otherwise it's a sub-request=item since: 2.0.00=back=head2 C<is_perl_option_enabled>check whether a directory level C<PerlOptions> flag is enabled or not.  $result = $r->is_perl_option_enabled($flag);=over 4=item obj: C<$r>( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )=item arg1: C<$flag> ( string )=item ret: C<$result> ( boolean )=item since: 2.0.00=backFor example to check whether the C<SetupEnv> option is enabled for thecurrent request (which can be disabled with C<PerlOptions -SetupEnv>)

⌨️ 快捷键说明

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