r49594 - in /trunk/liburi-perl: Changes META.yml URI.pm URI/_idna.pm URI/_server.pm debian/changelog t/idna.t t/iri.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Thu Dec 31 04:44:07 UTC 2009


Author: jawnsy-guest
Date: Thu Dec 31 04:44:01 2009
New Revision: 49594

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=49594
Log:
integrate new upstream release

Modified:
    trunk/liburi-perl/Changes
    trunk/liburi-perl/META.yml
    trunk/liburi-perl/URI.pm
    trunk/liburi-perl/URI/_idna.pm
    trunk/liburi-perl/URI/_server.pm
    trunk/liburi-perl/debian/changelog
    trunk/liburi-perl/t/idna.t
    trunk/liburi-perl/t/iri.t

Modified: trunk/liburi-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liburi-perl/Changes?rev=49594&op=diff
==============================================================================
--- trunk/liburi-perl/Changes (original)
+++ trunk/liburi-perl/Changes Thu Dec 31 04:44:01 2009
@@ -1,9 +1,23 @@
+2009-12-30   Gisle Aas <gisle at ActiveState.com>
+
+   Release 1.52
+
+   Gisle Aas (7):
+      Encode::decode('UTF-8',...) with callback implemented in 2.39
+      %%host%% hack can be removed when URI::_server::as_iri works
+      Don't croak on IRIs that can't be IDNA encoded
+      IDNA roundtrip test on wrong variable
+      Check behaviour when feeded URI constructor Latin-1 chars
+      Add some test examples from draft-duerst-iri-bis.txt
+      Need to recognize lower case hex digits as well
+
+
+
 2009-11-23   Gisle Aas <gisle at ActiveState.com>
 
    Release 1.51
 
    Fixup a test that was broken on Windows
-
 
 
 

Modified: trunk/liburi-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liburi-perl/META.yml?rev=49594&op=diff
==============================================================================
--- trunk/liburi-perl/META.yml (original)
+++ trunk/liburi-perl/META.yml Thu Dec 31 04:44:01 2009
@@ -1,12 +1,14 @@
 --- #YAML:1.0
 name:               URI
-version:            1.51
+version:            1.52
 abstract:           Uniform Resource Identifiers (absolute and relative)
 author:
     - Gisle Aas <gisle at activestate.com>
 license:            perl
 distribution_type:  module
 configure_requires:
+    ExtUtils::MakeMaker:  0
+build_requires:
     ExtUtils::MakeMaker:  0
 requires:
     MIME::Base64:  2
@@ -18,7 +20,7 @@
     directory:
         - t
         - inc
-generated_by:       ExtUtils::MakeMaker version 6.4801
+generated_by:       ExtUtils::MakeMaker version 6.55_02
 meta-spec:
     url:      http://module-build.sourceforge.net/META-spec-v1.4.html
     version:  1.4

Modified: trunk/liburi-perl/URI.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liburi-perl/URI.pm?rev=49594&op=diff
==============================================================================
--- trunk/liburi-perl/URI.pm (original)
+++ trunk/liburi-perl/URI.pm Thu Dec 31 04:44:01 2009
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw($VERSION);
-$VERSION = "1.51";
+$VERSION = "1.52";
 
 use vars qw($ABS_REMOTE_LEADING_DOTS $ABS_ALLOW_RELATIVE_SCHEME $DEFAULT_QUERY_FORM_DELIMITER);
 
@@ -260,22 +260,13 @@
 {
     my $self = shift;
     my $str = $$self;
-    if ($str =~ /\bxn--/ && $self->can("ihost")) {
-	my $ihost = $self->ihost;
-	if ($ihost) {
-	    my $u = $self->clone;
-	    $u->host("%%host%%");
-	    $str = $u->as_string;
-	    $str =~ s/%%host%%/$ihost/;
-	}
-    }
-    if ($str =~ s/%([89A-F][0-9A-F])/chr(hex($1))/eg) {
+    if ($str =~ s/%([89a-fA-F][0-9a-fA-F])/chr(hex($1))/eg) {
 	# All this crap because the more obvious:
 	#
 	#   Encode::decode("UTF-8", $str, sub { sprintf "%%%02X", shift })
 	#
-	# doesn't work.  Apparently passing a sub as CHECK only works
-	# for 'ascii' and similar direct encodings.
+	# doesn't work before Encode 2.39.  Wait for a standard release
+	# to bundle that version.
 
 	require Encode;
 	my $enc = Encode::find_encoding("UTF-8");

Modified: trunk/liburi-perl/URI/_idna.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liburi-perl/URI/_idna.pm?rev=49594&op=diff
==============================================================================
--- trunk/liburi-perl/URI/_idna.pm (original)
+++ trunk/liburi-perl/URI/_idna.pm Thu Dec 31 04:44:01 2009
@@ -67,12 +67,12 @@
     my $label = shift;
     $label = nameprep($label) unless $label =~ $ASCII;
     return $label unless $label =~ /^xn--/;
-    my $label1 = decode_punycode(substr($label, 4));
-    my $label2 = ToASCII($label);
+    my $result = decode_punycode(substr($label, 4));
+    my $label2 = ToASCII($result);
     if (lc($label) ne $label2) {
-	croak "IDNA does not round-trip: '$label' vs '$label2'";
+	croak "IDNA does not round-trip: '\L$label\E' vs '$label2'";
     }
-    return $label1;
+    return $result;
 }
 
 1;

Modified: trunk/liburi-perl/URI/_server.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liburi-perl/URI/_server.pm?rev=49594&op=diff
==============================================================================
--- trunk/liburi-perl/URI/_server.pm (original)
+++ trunk/liburi-perl/URI/_server.pm Thu Dec 31 04:44:01 2009
@@ -20,8 +20,11 @@
 
 sub _host_escape {
     return unless $_[0] =~ /[^URI::uric]/;
-    require URI::_idna;
-    $_[0] = URI::_idna::encode($_[0]);
+    eval {
+	require URI::_idna;
+	$_[0] = URI::_idna::encode($_[0]);
+    };
+    return 0 if $@;
     return 1;
 }
 
@@ -34,7 +37,7 @@
 	    my $ui = $host =~ s/(.*@)// ? $1 : "";
 	    my $port = $host =~ s/(:\d+)\z// ? $1 : "";
 	    require URI::_idna;
-	    $host = URI::_idna::encode($host);
+	    $host = URI::_idna::decode($host);
 	    $str = "$scheme//$ui$host$port$rest";
 	}
     }

Modified: trunk/liburi-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liburi-perl/debian/changelog?rev=49594&op=diff
==============================================================================
--- trunk/liburi-perl/debian/changelog (original)
+++ trunk/liburi-perl/debian/changelog Thu Dec 31 04:44:01 2009
@@ -1,11 +1,8 @@
-liburi-perl (1.51-1) UNRELEASED; urgency=low
-
-  Only fixes for Windows.
-  IGNORE-VERSION: 1.51-1
-
-  * New upstream release
-
- -- Jonathan Yu <jawnsy at cpan.org>  Mon, 23 Nov 2009 18:48:21 -0500
+liburi-perl (1.52-1) UNRELEASED; urgency=low
+
+  * New upstream release
+
+ -- Jonathan Yu <jawnsy at cpan.org>  Wed, 30 Dec 2009 23:43:37 -0500
 
 liburi-perl (1.50-1) unstable; urgency=low
 

Modified: trunk/liburi-perl/t/idna.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liburi-perl/t/idna.t?rev=49594&op=diff
==============================================================================
--- trunk/liburi-perl/t/idna.t (original)
+++ trunk/liburi-perl/t/idna.t Thu Dec 31 04:44:01 2009
@@ -2,7 +2,7 @@
 
 use strict;
 use utf8;
-use Test::More tests => 6;
+use Test::More tests => 7;
 use URI::_idna;
 
 is URI::_idna::encode("www.example.com"), "www.example.com";
@@ -11,3 +11,4 @@
 is URI::_idna::decode("www.example.com."), "www.example.com.";
 is URI::_idna::encode("Bücher.ch"), "xn--bcher-kva.ch";
 is URI::_idna::decode("xn--bcher-kva.ch"), "bücher.ch";
+is URI::_idna::decode("xn--bcher-KVA.ch"), "bücher.ch";

Modified: trunk/liburi-perl/t/iri.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liburi-perl/t/iri.t?rev=49594&op=diff
==============================================================================
--- trunk/liburi-perl/t/iri.t (original)
+++ trunk/liburi-perl/t/iri.t Thu Dec 31 04:44:01 2009
@@ -2,9 +2,10 @@
 
 use utf8;
 use strict;
-use Test::More tests => 11;
+use Test::More tests => 26;
 
 use URI;
+use URI::IRI;
 
 my $u;
 
@@ -21,8 +22,45 @@
 $u = URI->new("http://example.com/B%FCcher");  # latin1 encoded stuff
 is $u->as_iri, "http://example.com/B%FCcher";  # ...should not be decoded
 
+$u = URI->new("http://example.com/B\xFCcher");
+is $u->as_string, "http://example.com/B%FCcher";
+is $u->as_iri, "http://example.com/B%FCcher";
+
+$u = URI::IRI->new("http://example.com/B\xFCcher");
+is $u->as_string, "http://example.com/Bücher";
+is $u->as_iri, "http://example.com/Bücher";
+
+# draft-duerst-iri-bis.txt claims this should map to xn--rsum-bad.example.org
+$u = URI->new("http://r\xE9sum\xE9.example.org");
+is $u->as_string, "http://xn--rsum-bpad.example.org";
+
+$u = URI->new("http://xn--rsum-bad.example.org");
+is $u->as_iri, "http://r\x80sum\x80.example.org";
+
+$u = URI->new("http://r%C3%A9sum%C3%A9.example.org");
+is $u->as_string, "http://r%C3%A9sum%C3%A9.example.org";
+is $u->as_iri, "http://r\xE9sum\xE9.example.org";
+
 $u = URI->new("http://âž¡.ws/");
 is $u, "http://xn--hgi.ws/";
 is $u->host, "xn--hgi.ws";
 is $u->ihost, "âž¡.ws";
 is $u->as_iri, "http://âž¡.ws/";
+
+# draft-duerst-iri-bis.txt examples (section 3.7.1):
+is(URI->new("http://www.example.org/D%C3%BCrst")->as_iri, "http://www.example.org/D\xFCrst");
+is(URI->new("http://www.example.org/D%FCrst")->as_iri, "http://www.example.org/D%FCrst");
+TODO: {
+    local $TODO = "some chars (like U+202E, RIGHT-TO-LEFT OVERRIDE) need to stay escaped";
+is(URI->new("http://xn--99zt52a.example.org/%e2%80%ae")->as_iri, "http://\x{7D0D}\x{8C46}.example.org/%e2%80%ae");
+}
+
+# try some URLs that can't be IDNA encoded (fallback to encoded UTF8 bytes)
+$u = URI->new("http://" . ("ü" x 128));
+is $u, "http://" . ("%C3%BC" x 128);
+is $u->host, ("\xC3\xBC" x 128);
+TODO: {
+    local $TODO = "should ihost decode UTF8 bytes?";
+    is $u->ihost, ("ü" x 128);
+}
+is $u->as_iri, "http://" . ("ü" x 128);




More information about the Pkg-perl-cvs-commits mailing list