.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .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" '' . ds C` . ds C' '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 >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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 "libapache2-mod-perl2-2.0.11::docs::api::Apache2::URI 3pm" .TH libapache2-mod-perl2-2.0.11::docs::api::Apache2::URI 3pm "2021-02-22" "perl v5.32.1" "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::URI \- Perl API for manipulating URIs .SH "Synopsis" .IX Header "Synopsis" .Vb 1 \& use Apache2::URI (); \& \& $hostport = $r\->construct_server(); \& $hostport = $r\->construct_server($hostname); \& $hostport = $r\->construct_server($hostname, $port); \& $hostport = $r\->construct_server($hostname, $port, $pool); \& \& $url = $r\->construct_url(); \& $url = $r\->construct_url($rel_uri); \& $url = $r\->construct_url($rel_uri, $pool); \& \& $parsed_uri = $r\->parse_uri($uri); \& \& $parsed_uri = $r\->parsed_uri(); \& \& $url = join \*(Aq%20\*(Aq, qw(one two three); \& Apache2::URI::unescape_url($url); .Ve .SH "Description" .IX Header "Description" While \f(CW\*(C`APR::URI\*(C'\fR provides a generic \s-1API\s0 to dissect, adjust and put together any given \s-1URI\s0 string, \f(CW\*(C`Apache2::URI\*(C'\fR provides an \s-1API\s0 specific to Apache, by taking the information directly from the \f(CW$r\fR object. Therefore when manipulating the \s-1URI\s0 of the current \s-1HTTP\s0 request usually methods from both classes are used. .SH "API" .IX Header "API" \&\f(CW\*(C`Apache2::URI\*(C'\fR provides the following functions and methods: .ie n .SS """construct_server""" .el .SS "\f(CWconstruct_server\fP" .IX Subsection "construct_server" Construct a string made of hostname and port .PP .Vb 4 \& $hostport = $r\->construct_server(); \& $hostport = $r\->construct_server($hostname); \& $hostport = $r\->construct_server($hostname, $port); \& $hostport = $r\->construct_server($hostname, $port, $pool); .Ve .ie n .IP "obj: $r ( ""Apache2::RequestRec object"" )" 4 .el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4 .IX Item "obj: $r ( Apache2::RequestRec object )" The current request object .ie n .IP "opt arg1: $hostname ( string )" 4 .el .IP "opt arg1: \f(CW$hostname\fR ( string )" 4 .IX Item "opt arg1: $hostname ( string )" The hostname of the server. .Sp If that argument is not passed, \&\f(CW\*(C`$r\->get_server_name\*(C'\fR is used. .ie n .IP "opt arg2: $port ( string )" 4 .el .IP "opt arg2: \f(CW$port\fR ( string )" 4 .IX Item "opt arg2: $port ( string )" The port the server is running on. .Sp If that argument is not passed, \&\f(CW\*(C`$r\->get_server_port\*(C'\fR is used. .ie n .IP "opt arg3: $pool ( ""APR::Pool object"" )" 4 .el .IP "opt arg3: \f(CW$pool\fR ( \f(CWAPR::Pool object\fR )" 4 .IX Item "opt arg3: $pool ( APR::Pool object )" The pool to allocate the string from. .Sp If that argument is not passed, \&\f(CW\*(C`$r\->pool\*(C'\fR is used. .ie n .IP "ret: $hostport ( string )" 4 .el .IP "ret: \f(CW$hostport\fR ( string )" 4 .IX Item "ret: $hostport ( string )" The server's hostport string .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .PP Examples: .IP "\(bu" 4 Assuming that: .Sp .Vb 2 \& $r\->get_server_name == "localhost"; \& $r\->get_server_port == 8001; .Ve .Sp The code: .Sp .Vb 1 \& $hostport = $r\->construct_server(); .Ve .Sp returns a string: .Sp .Vb 1 \& localhost:8001 .Ve .IP "\(bu" 4 The following code sets the values explicitly: .Sp .Vb 1 \& $hostport = $r\->construct_server("my.example.com", 8888); .Ve .Sp and it returns a string: .Sp .Vb 1 \& my.example.com:8888 .Ve .ie n .SS """construct_url""" .el .SS "\f(CWconstruct_url\fP" .IX Subsection "construct_url" Build a fully qualified \s-1URL\s0 from the uri and information in the request rec: .PP .Vb 3 \& $url = $r\->construct_url(); \& $url = $r\->construct_url($rel_uri); \& $url = $r\->construct_url($rel_uri, $pool); .Ve .ie n .IP "obj: $r ( ""Apache2::RequestRec object"" )" 4 .el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4 .IX Item "obj: $r ( Apache2::RequestRec object )" The current request object .ie n .IP "opt arg1: $rel_uri ( string )" 4 .el .IP "opt arg1: \f(CW$rel_uri\fR ( string )" 4 .IX Item "opt arg1: $rel_uri ( string )" The path to the requested file (it may include a concatenation of \&\fIpath\fR, \fIquery\fR and \fIfragment\fR components). .Sp If that argument is not passed, \&\f(CW\*(C`$r\->uri\*(C'\fR is used. .ie n .IP "opt arg2: $pool ( ""APR::Pool object"" )" 4 .el .IP "opt arg2: \f(CW$pool\fR ( \f(CWAPR::Pool object\fR )" 4 .IX Item "opt arg2: $pool ( APR::Pool object )" The pool to allocate the \s-1URL\s0 from .Sp If that argument is not passed, \&\f(CW\*(C`$r\->pool\*(C'\fR is used. .ie n .IP "ret: $url ( string )" 4 .el .IP "ret: \f(CW$url\fR ( string )" 4 .IX Item "ret: $url ( string )" A fully qualified \s-1URL\s0 .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .PP Examples: .IP "\(bu" 4 Assuming that the request was .Sp .Vb 1 \& http://localhost.localdomain:8529/test?args .Ve .Sp The code: .Sp .Vb 1 \& my $url = $r\->construct_url; .Ve .Sp returns the string: .Sp .Vb 1 \& http://localhost.localdomain:8529/test .Ve .Sp notice that the query (args) component is not in the string. You need to append it manually if it's needed. .IP "\(bu" 4 Assuming that the request was .Sp .Vb 1 \& http://localhost.localdomain:8529/test?args .Ve .Sp The code: .Sp .Vb 2 \& my $rel_uri = "/foo/bar?tar"; \& my $url = $r\->construct_url($rel_uri); .Ve .Sp returns the string: .Sp .Vb 1 \& http://localhost.localdomain:8529/foo/bar?tar .Ve .ie n .SS """parse_uri""" .el .SS "\f(CWparse_uri\fP" .IX Subsection "parse_uri" Break apart \s-1URI\s0 (affecting the current request's uri components) .PP .Vb 1 \& $r\->parse_uri($uri); .Ve .ie n .IP "obj: $r ( ""Apache2::RequestRec object"" )" 4 .el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4 .IX Item "obj: $r ( Apache2::RequestRec object )" The current request object .ie n .IP "arg1: $uri ( string )" 4 .el .IP "arg1: \f(CW$uri\fR ( string )" 4 .IX Item "arg1: $uri ( string )" The uri to break apart .IP "ret: no return value" 4 .IX Item "ret: no return value" .PD 0 .IP "warning:" 4 .IX Item "warning:" .PD This method has several side-effects explained below .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .PP This method call has the following side-effects: .IP "1." 4 sets \f(CW\*(C`$r\->args\*(C'\fR to the rest after \f(CW\*(Aq?\*(Aq\fR if such exists in the passed \f(CW$uri\fR, otherwise sets it to \f(CW\*(C`undef\*(C'\fR. .IP "2." 4 sets \f(CW\*(C`$r\->uri\*(C'\fR to the passed \f(CW$uri\fR without the \&\f(CW\*(C`$r\->args\*(C'\fR part. .IP "3." 4 sets \&\f(CW\*(C`$r\->hostname\*(C'\fR (if not set already) using the (\f(CW\*(C`scheme://host:port\*(C'\fR) parts of the passed \f(CW$uri\fR. .ie n .SS """parsed_uri""" .el .SS "\f(CWparsed_uri\fP" .IX Subsection "parsed_uri" Get the current request's parsed uri object .PP .Vb 1 \& my $uri = $r\->parsed_uri(); .Ve .ie n .IP "obj: $r ( ""Apache2::RequestRec object"" )" 4 .el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4 .IX Item "obj: $r ( Apache2::RequestRec object )" The current request object .ie n .IP "ret: $uri ( ""APR::URI object"" )" 4 .el .IP "ret: \f(CW$uri\fR ( \f(CWAPR::URI object\fR )" 4 .IX Item "ret: $uri ( APR::URI object )" The parsed uri .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" This object is suitable for using with \f(CW\*(C`APR::URI::rpath\*(C'\fR .ie n .SS """unescape_url""" .el .SS "\f(CWunescape_url\fP" .IX Subsection "unescape_url" Unescape URLs .PP .Vb 1 \& Apache2::URI::unescape_url($url); .Ve .ie n .IP "obj: $url ( string )" 4 .el .IP "obj: \f(CW$url\fR ( string )" 4 .IX Item "obj: $url ( string )" The \s-1URL\s0 to unescape .IP "ret: no return value" 4 .IX Item "ret: no return value" The argument \f(CW$url\fR is now unescaped .IP "since: 2.0.00" 4 .IX Item "since: 2.0.00" .PP Example: .PP .Vb 2 \& my $url = join \*(Aq%20\*(Aq, qw(one two three); \& Apache2::URI::unescape_url($url); .Ve .PP \&\f(CW$url\fR now contains the string: .PP .Vb 1 \& "one two three"; .Ve .SH "See Also" .IX Header "See Also" \&\f(CW\*(C`APR::URI\*(C'\fR, mod_perl 2.0 documentation. .SH "Copyright" .IX Header "Copyright" mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0. .SH "Authors" .IX Header "Authors" The mod_perl development team and numerous contributors.