Skip to content

Commit

Permalink
Import of GAAS/URI-1.59 from CPAN.
Browse files Browse the repository at this point in the history
gitpan-cpan-distribution: URI
gitpan-cpan-version:      1.59
gitpan-cpan-path:         GAAS/URI-1.59.tar.gz
gitpan-cpan-author:       GAAS
gitpan-cpan-maturity:     released
  • Loading branch information
gisle authored and Gitpan committed Oct 21, 2014
1 parent 5d9ca27 commit 2127d38
Show file tree
Hide file tree
Showing 16 changed files with 65 additions and 34 deletions.
13 changes: 13 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
2011-08-15 Gisle Aas <gisle@ActiveState.com>

Release 1.59

Make sure accessor methods don't return utf8::upgraded() bytes
for URLs initialized from Unicode strings.

Version number increments.

Documentation tweaks.



2011-01-23 Gisle Aas <gisle@ActiveState.com>

Release 1.58
Expand Down
4 changes: 2 additions & 2 deletions META.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: URI
version: 1.58
version: 1.59
abstract: Uniform Resource Identifiers (absolute and relative)
author:
- Gisle Aas <gisle@activestate.com>
Expand All @@ -22,7 +22,7 @@ no_index:
directory:
- t
- inc
generated_by: ExtUtils::MakeMaker version 6.56
generated_by: ExtUtils::MakeMaker version 6.57_05
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
Expand Down
15 changes: 0 additions & 15 deletions Makefile.PL
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
require 5.008001;
use ExtUtils::MakeMaker;

if ("foo" !~ /\Afoo\z/) {
for $file ("URI", "URI/urn") {
print "\\z not supported by this perl. Fixing $file.pm...\n";
rename("$file.pm", "$file.pm.bak") || die;
open( IN, "<$file.pm.bak" ) || die;
open( OUT, ">$file.pm" ) || die;
while( <IN> ) {
$_ =~ s/\\z/\\Z/g;
print OUT;
}
close( OUT ) || die;
close( IN ) || die;
}
}

WriteMakefile(
'NAME' => 'URI',
'VERSION_FROM' => 'URI.pm',
Expand Down
28 changes: 25 additions & 3 deletions URI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package URI;

use strict;
use vars qw($VERSION);
$VERSION = "1.58";
$VERSION = "1.59";

use vars qw($ABS_REMOTE_LEADING_DOTS $ABS_ALLOW_RELATIVE_SCHEME $DEFAULT_QUERY_FORM_DELIMITER);

Expand Down Expand Up @@ -90,6 +90,7 @@ sub _uric_escape
{
my($class, $str) = @_;
$str =~ s*([^$uric\#])* URI::Escape::escape_char($1) *ego;
utf8::downgrade($str);
return $str;
}

Expand Down Expand Up @@ -218,6 +219,7 @@ sub opaque
my $new_opaque = shift;
$new_opaque = "" unless defined $new_opaque;
$new_opaque =~ s/([^$uric])/ URI::Escape::escape_char($1)/ego;
utf8::downgrade($new_opaque);

$$self = defined($old_scheme) ? $old_scheme : "";
$$self .= $new_opaque;
Expand All @@ -243,6 +245,7 @@ sub fragment
my $new_frag = shift;
if (defined $new_frag) {
$new_frag =~ s/([^$uric])/ URI::Escape::escape_char($1) /ego;
utf8::downgrade($new_frag);
$$self .= "#$new_frag";
}
$old;
Expand Down Expand Up @@ -470,7 +473,7 @@ argument, it updates the corresponding component in addition to
returning the old value of the component. Passing an undefined
argument removes the component (if possible). The description of
each accessor method indicates whether the component is passed as
an escaped or an unescaped string. A component that can be further
an escaped (percent-encoded) or an unescaped string. A component that can be further
divided into sub-parts are usually passed escaped, as unescaping might
change its semantics.
Expand Down Expand Up @@ -1050,14 +1053,33 @@ delimited by ";" instead of "&" which is the default.
=head1 BUGS
Using regexp variables like $1 directly as arguments to the URI methods
There are some things that are not quite right:
=over
=item *
Using regexp variables like $1 directly as arguments to the URI accessor methods
does not work too well with current perl implementations. I would argue
that this is actually a bug in perl. The workaround is to quote
them. Example:
/(...)/ || die;
$u->query("$1");
=item *
The escaping (percent encoding) of chars in the 128 .. 255 range passed to the
URI constructor or when setting URI parts using the accessor methods depend on
the state of the internal UTF8 flag (see utf8::is_utf8) of the string passed.
If the UTF8 flag is set the UTF-8 encoded version of the character is percent
encoded. If the UTF8 flag isn't set the Latin-1 version (byte) of the
character is percent encoded. This basically exposes the internal encoding of
Perl strings.
=back
=head1 PARSING URIs WITH REGEXP
As an alternative to this module, the following (official) regular
Expand Down
2 changes: 1 addition & 1 deletion URI/Escape.pm
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ our @ISA = qw(Exporter);
our %escapes;
our @EXPORT = qw(uri_escape uri_unescape uri_escape_utf8);
our @EXPORT_OK = qw(%escapes);
our $VERSION = "3.30";
our $VERSION = "3.31";

use Carp ();

Expand Down
2 changes: 1 addition & 1 deletion URI/Heuristic.pm
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ use vars qw(@EXPORT_OK $VERSION $MY_COUNTRY %LOCAL_GUESSING $DEBUG);
require Exporter;
*import = \&Exporter::import;
@EXPORT_OK = qw(uf_uri uf_uristr uf_url uf_urlstr);
$VERSION = "4.19";
$VERSION = "4.20";

sub MY_COUNTRY() {
for ($MY_COUNTRY) {
Expand Down
2 changes: 1 addition & 1 deletion URI/URL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require URI::WithBase;
use strict;
use vars qw(@EXPORT $VERSION);

$VERSION = "5.03";
$VERSION = "5.04";

# Provide as much as possible of the old URI::URL interface for backwards
# compatibility...
Expand Down
2 changes: 1 addition & 1 deletion URI/WithBase.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use vars qw($AUTOLOAD $VERSION);
use URI;

$VERSION = "2.19";
$VERSION = "2.20";

use overload '""' => "as_string", fallback => 1;

Expand Down
3 changes: 3 additions & 0 deletions URI/_generic.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ sub authority
my $rest = $3;
if (defined $auth) {
$auth =~ s/([^$ACHAR])/ URI::Escape::escape_char($1)/ego;
utf8::downgrade($auth);
$$self .= "//$auth";
}
_check_path($rest, $$self);
Expand All @@ -42,6 +43,7 @@ sub path
my $new_path = shift;
$new_path = "" unless defined $new_path;
$new_path =~ s/([^$PCHAR])/ URI::Escape::escape_char($1)/ego;
utf8::downgrade($new_path);
_check_path($new_path, $$self);
$$self .= $new_path . $rest;
}
Expand All @@ -59,6 +61,7 @@ sub path_query
my $new_path = shift;
$new_path = "" unless defined $new_path;
$new_path =~ s/([^$URI::uric])/ URI::Escape::escape_char($1)/ego;
utf8::downgrade($new_path);
_check_path($new_path, $$self);
$$self .= $new_path . $rest;
}
Expand Down
2 changes: 1 addition & 1 deletion URI/_ldap.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package URI::_ldap;
use strict;

use vars qw($VERSION);
$VERSION = "1.11";
$VERSION = "1.12";

use URI::Escape qw(uri_unescape);

Expand Down
2 changes: 1 addition & 1 deletion URI/_punycode.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package URI::_punycode;

use strict;
our $VERSION = "0.03";
our $VERSION = "0.04";

require Exporter;
our @ISA = qw(Exporter);
Expand Down
1 change: 1 addition & 0 deletions URI/_query.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ sub query
$$self = $1;
if (defined $q) {
$q =~ s/([^$URI::uric])/ URI::Escape::escape_char($1)/ego;
utf8::downgrade($q);
$$self .= "?$q";
}
$$self .= $3;
Expand Down
12 changes: 6 additions & 6 deletions URI/file.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use vars qw(@ISA $VERSION $DEFAULT_AUTHORITY %OS_CLASS);

require URI::_generic;
@ISA = qw(URI::_generic);
$VERSION = "4.20";
$VERSION = "4.21";

use URI::Escape qw(uri_unescape);

Expand Down Expand Up @@ -227,12 +227,12 @@ usually many URIs that map to any given file name. For instance, an
authority of "localhost" maps the same as a URI with a missing or empty
authority.
Example 1: The Mac uses ":" as path separator, but not in the same way
as a generic URI. ":foo" is a relative name. "foo:bar" is an absolute
name. Also, path segments can contain the "/" character as well as the
literal "." or "..". So the mapping looks like this:
Example 1: The Mac classic (Mac OS 9 and earlier) used ":" as path separator,
but not in the same way as a generic URI. ":foo" was a relative name. "foo:bar"
was an absolute name. Also, path segments could contain the "/" character as well
as the literal "." or "..". So the mapping looks like this:
Mac URI
Mac classic URI
---------- -------------------
:foo:bar <==> foo/bar
: <==> ./
Expand Down
2 changes: 1 addition & 1 deletion URI/ldap.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package URI::ldap;
use strict;

use vars qw(@ISA $VERSION);
$VERSION = "1.11";
$VERSION = "1.12";

require URI::_server;
require URI::_ldap;
Expand Down
2 changes: 1 addition & 1 deletion URI/sip.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use strict;
use vars qw(@ISA $VERSION);
use URI::Escape qw(uri_unescape);

$VERSION = "0.10";
$VERSION = "0.11";

sub default_port { 5060 }

Expand Down
7 changes: 7 additions & 0 deletions t/utf8.t
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ is(URI->new('http://foobar/mooi€e')->as_string, 'http://foobar/mooi%E2%82%ACe'
my $uri = URI->new('http:');
$uri->query_form("mooi€e" => "mooi€e");
is( $uri->query, "mooi%E2%82%ACe=mooi%E2%82%ACe" );
is( ($uri->query_form)[1], "mooi\xE2\x82\xACe" );

# RT#70161
use Encode;
$uri = URI->new(decode_utf8 '?Query=%C3%A4%C3%B6%C3%BC');
is( ($uri->query_form)[1], "\xC3\xA4\xC3\xB6\xC3\xBC");
is( decode_utf8(($uri->query_form)[1]), 'äöü');

0 comments on commit 2127d38

Please sign in to comment.