apr::uri.3

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

3
688
字号
.el .Sh "\f(CWparse\fP".IX Subsection "parse"Parse the \s-1URI\s0 string into \s-1URI\s0 components.PP.Vb 1\&  $parsed = APR::URI\->parse($pool, $uri);.Ve.ie n .IP "obj: $parsed\fR ( \f(CW""APR::URI object or class"" )" 4.el .IP "obj: \f(CW$parsed\fR ( \f(CWAPR::URI object or class\fR )" 4.IX Item "obj: $parsed ( APR::URI object or class )".PD 0.ie n .IP "arg1: $pool\fR ( string ) ( \f(CW""APR::Pool object"" )" 4.el .IP "arg1: \f(CW$pool\fR ( string ) ( \f(CWAPR::Pool object\fR )" 4.IX Item "arg1: $pool ( string ) ( APR::Pool object )".ie n .IP "arg2: $uri ( string )" 4.el .IP "arg2: \f(CW$uri\fR ( string )" 4.IX Item "arg2: $uri ( string )".PDThe \s-1URI\s0 to parse.ie n .IP "ret: $parsed\fR ( \f(CW""APR::URI object or class"" )" 4.el .IP "ret: \f(CW$parsed\fR ( \f(CWAPR::URI object or class\fR )" 4.IX Item "ret: $parsed ( APR::URI object or class )"The parsed \s-1URI\s0 object.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPAfter parsing, if a component existed but was an empty string(e.g. empty query \fIhttp://hostname/path?\fR) \*(-- the correspondingaccessor will return an empty string. If a component didn't exist(e.g. no query part \fIhttp://hostname/path\fR) \*(-- the correspondingaccessor will return \f(CW\*(C`undef\*(C'\fR..ie n .Sh """path""".el .Sh "\f(CWpath\fP".IX Subsection "path"Get/set the request path.PP.Vb 1\&  $oldval = $parsed\->path($newval);.Ve.ie n .IP "obj: $parsed\fR ( \f(CW""APR::URI object"" )" 4.el .IP "obj: \f(CW$parsed\fR ( \f(CWAPR::URI object\fR )" 4.IX Item "obj: $parsed ( APR::URI object )".PD 0.ie n .IP "opt arg1: $newval ( string or undef )" 4.el .IP "opt arg1: \f(CW$newval\fR ( string or undef )" 4.IX Item "opt arg1: $newval ( string or undef )".ie n .IP "ret: $oldval ( string or undef )" 4.el .IP "ret: \f(CW$oldval\fR ( string or undef )" 4.IX Item "ret: $oldval ( string or undef )".PD\&\f(CW"/"\fR if only \f(CW\*(C`scheme://host\*(C'\fR.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".ie n .Sh """rpath""".el .Sh "\f(CWrpath\fP".IX Subsection "rpath"Gets the \f(CW\*(C`path\*(C'\fR minus the \&\f(CW\*(C`path_info\*(C'\fR.PP.Vb 1\&  $rpath =  $parsed\->rpath();.Ve.ie n .IP "obj: $parsed\fR ( \f(CW""APR::URI object"" )" 4.el .IP "obj: \f(CW$parsed\fR ( \f(CWAPR::URI object\fR )" 4.IX Item "obj: $parsed ( APR::URI object )".PD 0.ie n .IP "opt arg1: $newval ( string or undef )" 4.el .IP "opt arg1: \f(CW$newval\fR ( string or undef )" 4.IX Item "opt arg1: $newval ( string or undef )".ie n .IP "ret: $oldval ( string or undef )" 4.el .IP "ret: \f(CW$oldval\fR ( string or undef )" 4.IX Item "ret: $oldval ( string or undef )".PDThe path minus the \fIpath_info\fR.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".ie n .Sh """port""".el .Sh "\f(CWport\fP".IX Subsection "port"Get/set port number.PP.Vb 1\&  $oldval = $parsed\->port($newval);.Ve.ie n .IP "obj: $parsed\fR ( \f(CW""APR::URI object"" )" 4.el .IP "obj: \f(CW$parsed\fR ( \f(CWAPR::URI object\fR )" 4.IX Item "obj: $parsed ( APR::URI object )".PD 0.ie n .IP "opt arg1: $newval ( number or string or undef )" 4.el .IP "opt arg1: \f(CW$newval\fR ( number or string or undef )" 4.IX Item "opt arg1: $newval ( number or string or undef )".ie n .IP "ret: $oldval ( string or undef )" 4.el .IP "ret: \f(CW$oldval\fR ( string or undef )" 4.IX Item "ret: $oldval ( string or undef )".PDIf the port component didn't appear in the parsed \s-1URI\s0, \s-1APR\s0 internallycalls \f(CW\*(C`port_of_scheme()\*(C'\fR to find out the portnumber for the given \f(CW\*(C`scheme()\*(C'\fR..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".ie n .Sh """port_of_scheme""".el .Sh "\f(CWport_of_scheme\fP".IX Subsection "port_of_scheme"Return the default port for a given scheme.  The recognized schemesare http, ftp, https, gopher, wais, nntp, snews and prospero..PP.Vb 1\&  $port = APR::URI::port_of_scheme($scheme);.Ve.ie n .IP "obj: $scheme ( string )" 4.el .IP "obj: \f(CW$scheme\fR ( string )" 4.IX Item "obj: $scheme ( string )"The scheme string.ie n .IP "ret: $port (integer)" 4.el .IP "ret: \f(CW$port\fR (integer)" 4.IX Item "ret: $port (integer)"The default port for this scheme.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".ie n .Sh """query""".el .Sh "\f(CWquery\fP".IX Subsection "query"Get/set the query string (the part starting after \f(CW\*(Aq?\*(Aq\fR and all theway till the end or the \f(CW\*(Aq#fragment\*(Aq\fR part if the latter exists)..PP.Vb 1\&  $oldval = $parsed\->query($newval);.Ve.ie n .IP "obj: $parsed\fR ( \f(CW""APR::URI object"" )" 4.el .IP "obj: \f(CW$parsed\fR ( \f(CWAPR::URI object\fR )" 4.IX Item "obj: $parsed ( APR::URI object )".PD 0.ie n .IP "opt arg1: $newval ( string or undef )" 4.el .IP "opt arg1: \f(CW$newval\fR ( string or undef )" 4.IX Item "opt arg1: $newval ( string or undef )".ie n .IP "ret: $oldval ( string or undef )" 4.el .IP "ret: \f(CW$oldval\fR ( string or undef )" 4.IX Item "ret: $oldval ( string or undef )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.ie n .Sh """scheme""".el .Sh "\f(CWscheme\fP".IX Subsection "scheme"Get/set the protocol scheme (\*(L"http\*(R", \*(L"ftp\*(R", ...).PP.Vb 1\&  $oldval = $parsed\->scheme($newval);.Ve.ie n .IP "obj: $parsed\fR ( \f(CW""APR::URI object"" )" 4.el .IP "obj: \f(CW$parsed\fR ( \f(CWAPR::URI object\fR )" 4.IX Item "obj: $parsed ( APR::URI object )".PD 0.ie n .IP "opt arg1: $newval ( string or undef )" 4.el .IP "opt arg1: \f(CW$newval\fR ( string or undef )" 4.IX Item "opt arg1: $newval ( string or undef )".ie n .IP "ret: $oldval ( string or undef )" 4.el .IP "ret: \f(CW$oldval\fR ( string or undef )" 4.IX Item "ret: $oldval ( string or undef )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.ie n .Sh """user""".el .Sh "\f(CWuser\fP".IX Subsection "user"Get/set user name (as in http://user:password@host:port/).PP.Vb 1\&  $oldval = $parsed\->user($newval);.Ve.ie n .IP "obj: $parsed\fR ( \f(CW""APR::URI object"" )" 4.el .IP "obj: \f(CW$parsed\fR ( \f(CWAPR::URI object\fR )" 4.IX Item "obj: $parsed ( APR::URI object )".PD 0.ie n .IP "opt arg1: $newval ( string or undef )" 4.el .IP "opt arg1: \f(CW$newval\fR ( string or undef )" 4.IX Item "opt arg1: $newval ( string or undef )".ie n .IP "ret: $oldval ( string or undef )" 4.el .IP "ret: \f(CW$oldval\fR ( string or undef )" 4.IX Item "ret: $oldval ( string or undef )".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.ie n .Sh """unparse""".el .Sh "\f(CWunparse\fP".IX Subsection "unparse"Unparse the \s-1URI\s0 components back into a \s-1URI\s0 string.PP.Vb 2\&  $new_uri = $parsed\->unparse();\&  $new_uri = $parsed\->unparse($flags);.Ve.ie n .IP "obj: $parsed\fR ( \f(CW""APR::URI object"" )" 4.el .IP "obj: \f(CW$parsed\fR ( \f(CWAPR::URI object\fR )" 4.IX Item "obj: $parsed ( APR::URI object )".PD 0.ie n .IP "opt arg1: $flags ( the APR::Const :uri constants )" 4.el .IP "opt arg1: \f(CW$flags\fR ( the APR::Const :uri constants )" 4.IX Item "opt arg1: $flags ( the APR::Const :uri constants )".PDBy default the constant \f(CW\*(C`APR::Const::URI_UNP_OMITPASSWORD\*(C'\fR is passed..SpIf you need to pass more than one flag use unary \f(CW\*(C`|\*(C'\fR, e.g.:.Sp.Vb 1\&  $flags = APR::Const::URI_UNP_OMITUSER|APR::Const::URI_UNP_OMITPASSWORD;.Ve.SpThe valid \f(CW\*(C`flags\*(C'\fR constants are listed next.ie n .IP "ret: $new_uri ( string )" 4.el .IP "ret: \f(CW$new_uri\fR ( string )" 4.IX Item "ret: $new_uri ( string )".PD 0.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PPValid \f(CW\*(C`flags\*(C'\fR constants:.PPTo import all \s-1URI\s0 constants you could do:.PP.Vb 1\&  use APR::Const \-compile => qw(:uri);.Ve.PPbut there is a significant amount of them, most irrelevant to thismethod. Therefore you probably don't want to do that. Instead specifyexplicitly the ones that you need. All the relevant to this methodconstants start with \f(CW\*(C`APR::URI_UNP_\*(C'\fR..PPAnd the available constants are:.ie n .IP """APR::Const::URI_UNP_OMITSITEPART""" 4.el .IP "\f(CWAPR::Const::URI_UNP_OMITSITEPART\fR" 4.IX Item "APR::Const::URI_UNP_OMITSITEPART"Don't show \f(CW\*(C`scheme\*(C'\fR, \f(CW\*(C`user\*(C'\fR,\&\f(CW\*(C`password\*(C'\fR, \f(CW\*(C`hostname\*(C'\fR and\&\f(CW\*(C`port\*(C'\fR components (i.e. if you want only the relative\&\s-1URI\s0).ie n .IP """APR::Const::URI_UNP_OMITUSER""" 4.el .IP "\f(CWAPR::Const::URI_UNP_OMITUSER\fR" 4.IX Item "APR::Const::URI_UNP_OMITUSER"Hide the \f(CW\*(C`user\*(C'\fR component.ie n .IP """APR::Const::URI_UNP_OMITPASSWORD""" 4.el .IP "\f(CWAPR::Const::URI_UNP_OMITPASSWORD\fR" 4.IX Item "APR::Const::URI_UNP_OMITPASSWORD"Hide the \f(CW\*(C`password\*(C'\fR component (the default).ie n .IP """APR::Const::URI_UNP_REVEALPASSWORD""" 4.el .IP "\f(CWAPR::Const::URI_UNP_REVEALPASSWORD\fR" 4.IX Item "APR::Const::URI_UNP_REVEALPASSWORD"Reveal the \f(CW\*(C`password\*(C'\fR component.ie n .IP """APR::Const::URI_UNP_OMITPATHINFO""" 4.el .IP "\f(CWAPR::Const::URI_UNP_OMITPATHINFO\fR" 4.IX Item "APR::Const::URI_UNP_OMITPATHINFO"Don't show \f(CW\*(C`path\*(C'\fR, \f(CW\*(C`query\*(C'\fR and\&\f(CW\*(C`fragment\*(C'\fR components.ie n .IP """APR::Const::URI_UNP_OMITQUERY""" 4.el .IP "\f(CWAPR::Const::URI_UNP_OMITQUERY\fR" 4.IX Item "APR::Const::URI_UNP_OMITQUERY"Don't show \f(CW\*(C`query\*(C'\fR and \f(CW\*(C`fragment\*(C'\fRcomponents.PPNotice that some flags overlap..PPIf the optional \f(CW$flags\fR argument is passed and contains no\&\f(CW\*(C`APR::Const::URI_UNP_OMITPASSWORD\*(C'\fR and no \f(CW\*(C`APR::Const::URI_UNP_REVEALPASSWORD\*(C'\fR \*(--the \f(CW\*(C`password\*(C'\fR part will be rendered as a literal\&\f(CW"XXXXXXXX"\fR string..PPIf the \f(CW\*(C`port\*(C'\fR number matches the\&\f(CW\*(C`port_of_scheme()\*(C'\fR, the unparsed \s-1URI\s0 won'tinclude it and there is no flag to force that \f(CW\*(C`port\*(C'\fR toappear. If the \f(CW\*(C`port\*(C'\fR number is non-standard it will showup in the unparsed string..PPExamples:.PPStarting with the parsed \s-1URL:\s0.PP.Vb 3\&  use APR::URI ();\&  my $url = \*(Aqhttp://user:pass@example.com:80/foo?bar#item5\*(Aq;\&  my $parsed = APR::URI\->parse($r\->pool, $url);.Ve.PPdeparse it back including and excluding parts, using different valuesfor the optional \f(CW\*(C`flags\*(C'\fR argument:.IP "\(bu" 4Show all but the \f(CW\*(C`password\*(C'\fR fields:.Sp.Vb 1\&  print $parsed\->unparse;.Ve.SpPrints:.Sp.Vb 1\&  http://user@example.com/foo?bar#item5.Ve.SpNotice that the \f(CW\*(C`port\*(C'\fR field is gone too, since it was adefault \f(CW\*(C`port\*(C'\fR for \f(CW\*(C`scheme\*(C'\fR\&\f(CW\*(C`http://\*(C'\fR..IP "\(bu" 4Include the \f(CW\*(C`password\*(C'\fR field (by default it's not revealed).Sp.Vb 2\&  use APR::Const \-compile => qw(URI_UNP_REVEALPASSWORD);\&  print $parsed\->unparse(APR::Const::URI_UNP_REVEALPASSWORD);.Ve.SpPrints:.Sp.Vb 1\&  http://user:pass@example.com/foo?bar#item5.Ve.IP "\(bu" 4Show all fields but the last three, \f(CW\*(C`path\*(C'\fR,\&\f(CW\*(C`query\*(C'\fR and \f(CW\*(C`fragment\*(C'\fR:.Sp.Vb 4\&  use APR::Const \-compile => qw(URI_UNP_REVEALPASSWORD\&                                APR::Const::URI_UNP_OMITPATHINFO);\&  print $parsed\->unparse(\&      APR::Const::URI_UNP_REVEALPASSWORD|URI_UNP_OMITPATHINFO);.Ve.SpPrints:.Sp.Vb 1\&  http://user:pass@example.com.Ve.SH "See Also".IX Header "See Also"\&\f(CW\*(C`Apache2::URI\*(C'\fR, mod_perl 2.0documentation..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 + -
显示快捷键?