<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"># 
# /*
#  * *********** WARNING **************
#  * This file generated by ModPerl::WrapXS/0.01
#  * Any changes made here will be lost
#  * ***********************************
#  * 01: lib/ModPerl/Code.pm:709
#  * 02: lib/ModPerl/WrapXS.pm:633
#  * 03: lib/ModPerl/WrapXS.pm:1182
#  * 04: Makefile.PL:427
#  * 05: Makefile.PL:329
#  * 06: Makefile.PL:58
#  */
# 


package APR::URI;

use strict;
use warnings FATAL =&gt; 'all';


use APR ();
use APR::XSLoader ();
our $VERSION = '0.009000';
APR::XSLoader::load __PACKAGE__;



1;
__END__

=head1 NAME

APR::URI - Perl API for URI manipulations




=head1 Synopsis

  use APR::URI ();
  
  my $url = 'http://user:pass@example.com:80/foo?bar#item5';
  
  # parse and break the url into components
  my $parsed = APR::URI-&gt;parse($r-&gt;pool, $url);
  print $parsed-&gt;scheme;
  print $parsed-&gt;user;
  print $parsed-&gt;password;
  print $parsed-&gt;hostname;
  print $parsed-&gt;port;
  print $parsed-&gt;path;
  print $parsed-&gt;rpath;
  print $parsed-&gt;query;
  print $parsed-&gt;fragment;
  
  # reconstruct the url, after changing some components and completely
  # removing other
  $parsed-&gt;scheme($new_scheme);
  $parsed-&gt;user(undef);
  $parsed-&gt;password(undef);
  $parsed-&gt;hostname($new_hostname);
  $parsed-&gt;port($new_port);
  $parsed-&gt;path($new_path);
  $parsed-&gt;query(undef);
  $parsed-&gt;fragment(undef);
  print $parsed-&gt;unparse;
  
  # get the password field too (by default it's not revealed)
  use APR::Const -compile =&gt; qw(URI_UNP_REVEALPASSWORD);
  print $parsed-&gt;unparse(APR::Const::URI_UNP_REVEALPASSWORD);
  
  # what the default port for the ftp protocol?
  my $ftp_port = APR::URI::port_of_scheme("ftp");




=head1 Description

C&lt;APR::URI&gt; allows you to parse URI strings, manipulate each of the
URI elements and deparse them back into URIs.

All C&lt;APR::URI&gt; object accessors accept a string or an C&lt;undef&gt; value
as an argument. Same goes for return value. It's important to
distinguish between an empty string and C&lt;undef&gt;. For example let's
say your code was:

  my $uri = 'http://example.com/foo?bar#item5';
  my $parsed = APR::URI-&gt;parse($r-&gt;pool, $uri);

Now you no longer want to the query and fragment components in the
final url. If you do:

  $parsed-&gt;fragment('');
  $parsed-&gt;query('');

followed by:

  my $new_uri = parsed-&gt;unparse;

the resulting URI will be:

  http://example.com/foo?#

which is probably not something that you've expected. In order to get
rid of the separators, you must completely unset the fields you don't
want to see. So, if you do:

  $parsed-&gt;fragment(undef);
  $parsed-&gt;query(undef);

followed by:

  my $new_uri = parsed-&gt;unparse;

the resulting URI will be:

   http://example.com/foo

As mentioned earlier the same goes for return values, so continuing
this example:

  my $new_fragment = $parsed-&gt;fragment();
  my $new_query    = $parsed-&gt;query();

Both values now contain C&lt;undef&gt;, therefore you must be careful when
using the return values, when you use them, as you may get warnings.

Also make sure you read through C&lt;L&lt;the unparse()
section|/C_unparse_&gt;&gt; as various optional flags affect how the
deparsed URI is rendered.




=head1 API

C&lt;APR::URI&gt; provides the following functions and/or methods:






=head2 C&lt;fragment&gt;

Get/set trailing "#fragment" string

  $oldval = $parsed-&gt;fragment($newval);

=over 4

=item obj: C&lt;$parsed&gt;
( C&lt;L&lt;APR::URI object|docs::2.0::api::APR::URI&gt;&gt; )

=item opt arg1: C&lt;$newval&gt; ( string or undef )

=item ret: C&lt;$oldval&gt; ( string or undef )

=item since: 2.0.00

=back






=head2 C&lt;hostinfo&gt;

Get/set combined C&lt;[user[:password]@]host[:port]&gt;

  $oldval = $parsed-&gt;hostinfo($newval);

=over 4

=item obj: C&lt;$parsed&gt;
( C&lt;L&lt;APR::URI object|docs::2.0::api::APR::URI&gt;&gt; )

=item opt arg1: C&lt;$newval&gt; ( string or undef )

=item ret: C&lt;$oldval&gt; ( string or undef )

=item since: 2.0.00

=back

The C&lt;hostinfo&gt; value is set automatically when
C&lt;L&lt;parse()|/C_parse_&gt;&gt; is called.

It's not updated if any of the individual fields is modified.

It's not used when C&lt;L&lt;unparse()|/C_unparse_&gt;&gt; is called.






=head2 C&lt;hostname&gt;

Get/set hostname

  $oldval = $parsed-&gt;hostname($newval);

=over 4

=item obj: C&lt;$parsed&gt;
( C&lt;L&lt;APR::URI object|docs::2.0::api::APR::URI&gt;&gt; )

=item opt arg1: C&lt;$newval&gt; ( string or undef )

=item ret: C&lt;$oldval&gt; ( string or undef )

=item since: 2.0.00

=back












=head2 C&lt;password&gt;

Get/set password (as in http://user:password@host:port/)

  $oldval = $parsed-&gt;password($newval);

=over 4

=item obj: C&lt;$parsed&gt;
( C&lt;L&lt;APR::URI object|docs::2.0::api::APR::URI&gt;&gt; )

=item opt arg1: C&lt;$newval&gt; ( string or undef )

=item ret: C&lt;$oldval&gt; ( string or undef )

=item since: 2.0.00

=back






=head2 C&lt;parse&gt;

Parse the URI string into URI components

  $parsed = APR::URI-&gt;parse($pool, $uri);

=over 4

=item obj: C&lt;$parsed&gt;
( C&lt;L&lt;APR::URI object or class|docs::2.0::api::APR::URI&gt;&gt; )

=item arg1: C&lt;$pool&gt; ( string )
( C&lt;L&lt;APR::Pool object|docs::2.0::api::APR::Pool&gt;&gt; )

=item arg2: C&lt;$uri&gt; ( string )

The URI to parse

=item ret: C&lt;$parsed&gt;
( C&lt;L&lt;APR::URI object or class|docs::2.0::api::APR::URI&gt;&gt; )

The parsed URI object

=item since: 2.0.00

=back

After parsing, if a component existed but was an empty string
(e.g. empty query I&lt;http://hostname/path?&gt;) -- the corresponding
accessor will return an empty string. If a component didn't exist
(e.g. no query part I&lt;http://hostname/path&gt;) -- the corresponding
accessor will return C&lt;undef&gt;.




=head2 C&lt;path&gt;

Get/set the request path

  $oldval = $parsed-&gt;path($newval);

=over 4

=item obj: C&lt;$parsed&gt;
( C&lt;L&lt;APR::URI object|docs::2.0::api::APR::URI&gt;&gt; )

=item opt arg1: C&lt;$newval&gt; ( string or undef )

=item ret: C&lt;$oldval&gt; ( string or undef )

C&lt;"/"&gt; if only C&lt;scheme://host&gt;

=item since: 2.0.00

=back





=head2 C&lt;rpath&gt;

Gets the C&lt;L&lt;path|/C_path_&gt;&gt; minus the 
C&lt;L&lt;path_info|docs::2.0::api::Apache2::RequestRec/C_path_info_&gt;&gt;

  $rpath =  $parsed-&gt;rpath();

=over 4

=item obj: C&lt;$parsed&gt;
( C&lt;L&lt;APR::URI object|docs::2.0::api::APR::URI&gt;&gt; )

=item opt arg1: C&lt;$newval&gt; ( string or undef )

=item ret: C&lt;$oldval&gt; ( string or undef )

The path minus the I&lt;path_info&gt;

=item since: 2.0.00

=back






=head2 C&lt;port&gt;

Get/set port number

  $oldval = $parsed-&gt;port($newval);

=over 4

=item obj: C&lt;$parsed&gt;
( C&lt;L&lt;APR::URI object|docs::2.0::api::APR::URI&gt;&gt; )

=item opt arg1: C&lt;$newval&gt; ( number or string or undef )

=item ret: C&lt;$oldval&gt; ( string or undef )

If the port component didn't appear in the parsed URI, APR internally
calls C&lt;L&lt;port_of_scheme()|/C_port_of_scheme_&gt;&gt; to find out the port
number for the given C&lt;L&lt;scheme()|/C_scheme_&gt;&gt;.

=item since: 2.0.00

=back






=head2 C&lt;port_of_scheme&gt;

Return the default port for a given scheme.  The recognized schemes
are http, ftp, https, gopher, wais, nntp, snews and prospero.

  $port = APR::URI::port_of_scheme($scheme);

=over 4

=item obj: C&lt;$scheme&gt; ( string )

The scheme string

=item ret: C&lt;$port&gt; (integer)

The default port for this scheme

=item since: 2.0.00

=back





=head2 C&lt;query&gt;

Get/set the query string (the part starting after C&lt;'?'&gt; and all the
way till the end or the C&lt;'#fragment'&gt; part if the latter exists).

  $oldval = $parsed-&gt;query($newval);

=over 4

=item obj: C&lt;$parsed&gt;
( C&lt;L&lt;APR::URI object|docs::2.0::api::APR::URI&gt;&gt; )

=item opt arg1: C&lt;$newval&gt; ( string or undef )

=item ret: C&lt;$oldval&gt; ( string or undef )

=item since: 2.0.00

=back






=head2 C&lt;scheme&gt;

Get/set the protocol scheme ("http", "ftp", ...)

  $oldval = $parsed-&gt;scheme($newval);

=over 4

=item obj: C&lt;$parsed&gt;
( C&lt;L&lt;APR::URI object|docs::2.0::api::APR::URI&gt;&gt; )

=item opt arg1: C&lt;$newval&gt; ( string or undef )

=item ret: C&lt;$oldval&gt; ( string or undef )

=item since: 2.0.00

=back





=head2 C&lt;user&gt;

Get/set user name (as in http://user:password@host:port/)

  $oldval = $parsed-&gt;user($newval);

=over 4

=item obj: C&lt;$parsed&gt;
( C&lt;L&lt;APR::URI object|docs::2.0::api::APR::URI&gt;&gt; )

=item opt arg1: C&lt;$newval&gt; ( string or undef )

=item ret: C&lt;$oldval&gt; ( string or undef )

=item since: 2.0.00

=back




=head2 C&lt;unparse&gt;

Unparse the URI components back into a URI string

  $new_uri = $parsed-&gt;unparse();
  $new_uri = $parsed-&gt;unparse($flags);

=over 4

=item obj: C&lt;$parsed&gt;
( C&lt;L&lt;APR::URI object|docs::2.0::api::APR::URI&gt;&gt; )

=item opt arg1: C&lt;$flags&gt; ( L&lt;the APR::Const :uri
constants|docs::2.0::api::APR::Const/C__uri_&gt; )

By default the constant C&lt;APR::Const::URI_UNP_OMITPASSWORD&gt; is passed.

If you need to pass more than one flag use unary C&lt;|&gt;, e.g.:

  $flags = APR::Const::URI_UNP_OMITUSER|APR::Const::URI_UNP_OMITPASSWORD;

The valid C&lt;flags&gt; constants are listed next

=item ret: C&lt;$new_uri&gt; ( string )

=item since: 2.0.00

=back

Valid C&lt;flags&gt; constants:

To import all URI constants you could do:

  use APR::Const -compile =&gt; qw(:uri);

but there is a significant amount of them, most irrelevant to this
method. Therefore you probably don't want to do that. Instead specify
explicitly the ones that you need. All the relevant to this method
constants start with C&lt;APR::URI_UNP_&gt;.

And the available constants are:

=over 4

=item C&lt;APR::Const::URI_UNP_OMITSITEPART&gt;

Don't show C&lt;L&lt;scheme|/C_scheme_&gt;&gt;, C&lt;L&lt;user|/C_user_&gt;&gt;,
C&lt;L&lt;password|/C_password_&gt;&gt;, C&lt;L&lt;hostname|/C_hostname_&gt;&gt; and
C&lt;L&lt;port|/C_port_&gt;&gt; components (i.e. if you want only the relative
URI)

=item C&lt;APR::Const::URI_UNP_OMITUSER&gt;

Hide the C&lt;L&lt;user|/C_user_&gt;&gt; component

=item C&lt;APR::Const::URI_UNP_OMITPASSWORD&gt;

Hide the C&lt;L&lt;password|/C_password_&gt;&gt; component (the default)

=item C&lt;APR::Const::URI_UNP_REVEALPASSWORD&gt;

Reveal the C&lt;L&lt;password|/C_password_&gt;&gt; component

=item C&lt;APR::Const::URI_UNP_OMITPATHINFO&gt;

Don't show C&lt;L&lt;path|/C_path_&gt;&gt;, C&lt;L&lt;query|/C_query_&gt;&gt; and
C&lt;L&lt;fragment|/C_fragment_&gt;&gt; components

=item C&lt;APR::Const::URI_UNP_OMITQUERY&gt;

Don't show C&lt;L&lt;query|/C_query_&gt;&gt; and C&lt;L&lt;fragment|/C_fragment_&gt;&gt;
components

=back

Notice that some flags overlap.

If the optional C&lt;$flags&gt; argument is passed and contains no
C&lt;APR::Const::URI_UNP_OMITPASSWORD&gt; and no C&lt;APR::Const::URI_UNP_REVEALPASSWORD&gt; --
the C&lt;L&lt;password|/C_password_&gt;&gt; part will be rendered as a literal
C&lt;"XXXXXXXX"&gt; string.

If the C&lt;L&lt;port|/C_port_&gt;&gt; number matches the
C&lt;L&lt;port_of_scheme()|/C_port_of_scheme_&gt;&gt;, the unparsed URI won't
include it and there is no flag to force that C&lt;L&lt;port|/C_port_&gt;&gt; to
appear. If the C&lt;L&lt;port|/C_port_&gt;&gt; number is non-standard it will show
up in the unparsed string.

Examples:

Starting with the parsed URL:

  use APR::URI ();
  my $url = 'http://user:pass@example.com:80/foo?bar#item5';
  my $parsed = APR::URI-&gt;parse($r-&gt;pool, $url);

deparse it back including and excluding parts, using different values
for the optional C&lt;flags&gt; argument:

=over 4

=item *

Show all but the C&lt;L&lt;password|/C_password_&gt;&gt; fields:

  print $parsed-&gt;unparse;

Prints:

  http://user@example.com/foo?bar#item5

Notice that the C&lt;L&lt;port|/C_port_&gt;&gt; field is gone too, since it was a
default C&lt;L&lt;port|/C_port_of_scheme_&gt;&gt; for C&lt;L&lt;scheme|/C_scheme_&gt;&gt;
C&lt;http://&gt;.

=item *

Include the C&lt;L&lt;password|/C_password_&gt;&gt; field (by default it's not revealed)

  use APR::Const -compile =&gt; qw(URI_UNP_REVEALPASSWORD);
  print $parsed-&gt;unparse(APR::Const::URI_UNP_REVEALPASSWORD);

Prints:

  http://user:pass@example.com/foo?bar#item5

=item *

Show all fields but the last three, C&lt;L&lt;path|/C_path_&gt;&gt;,
C&lt;L&lt;query|/C_query_&gt;&gt; and C&lt;L&lt;fragment|/C_fragment_&gt;&gt;:

  use APR::Const -compile =&gt; qw(URI_UNP_REVEALPASSWORD
                                APR::Const::URI_UNP_OMITPATHINFO);
  print $parsed-&gt;unparse(
      APR::Const::URI_UNP_REVEALPASSWORD|URI_UNP_OMITPATHINFO);

Prints:

  http://user:pass@example.com

=back







=head1 See Also

C&lt;L&lt;Apache2::URI|docs::2.0::api::Apache2::URI&gt;&gt;, L&lt;mod_perl 2.0
documentation|docs::2.0::index&gt;.




=head1 Copyright

mod_perl 2.0 and its core modules are copyrighted under
The Apache Software License, Version 2.0.




=head1 Authors

L&lt;The mod_perl development team and numerous
contributors|about::contributors::people&gt;.

=cut

</pre></body></html>