Imported Upstream version 5.12 upstream/5.12
authorDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 22 Jul 2022 06:08:11 +0000 (15:08 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 22 Jul 2022 06:08:11 +0000 (15:08 +0900)
71 files changed:
Changes
MANIFEST
META.json
META.yml
Makefile.PL
README
cpanfile
lib/URI.pm
lib/URI/Escape.pm
lib/URI/Heuristic.pm
lib/URI/IRI.pm
lib/URI/QueryParam.pm
lib/URI/Split.pm
lib/URI/URL.pm
lib/URI/WithBase.pm
lib/URI/_foreign.pm
lib/URI/_generic.pm
lib/URI/_idna.pm
lib/URI/_ldap.pm
lib/URI/_login.pm
lib/URI/_punycode.pm
lib/URI/_query.pm
lib/URI/_segment.pm
lib/URI/_server.pm
lib/URI/_userpass.pm
lib/URI/data.pm
lib/URI/file.pm
lib/URI/file/Base.pm
lib/URI/file/FAT.pm
lib/URI/file/Mac.pm
lib/URI/file/OS2.pm
lib/URI/file/QNX.pm
lib/URI/file/Unix.pm
lib/URI/file/Win32.pm
lib/URI/ftp.pm
lib/URI/gopher.pm
lib/URI/http.pm
lib/URI/https.pm
lib/URI/ldap.pm
lib/URI/ldapi.pm
lib/URI/ldaps.pm
lib/URI/mailto.pm
lib/URI/mms.pm
lib/URI/news.pm
lib/URI/nntp.pm
lib/URI/nntps.pm
lib/URI/pop.pm
lib/URI/rlogin.pm
lib/URI/rsync.pm
lib/URI/rtsp.pm
lib/URI/rtspu.pm
lib/URI/sftp.pm
lib/URI/sip.pm
lib/URI/sips.pm
lib/URI/snews.pm
lib/URI/ssh.pm
lib/URI/telnet.pm
lib/URI/tn3270.pm
lib/URI/urn.pm
lib/URI/urn/isbn.pm
lib/URI/urn/oid.pm
t/00-report-prereqs.dd
t/file.t
t/mailto.t
t/old-base.t
t/sq-brackets-legacy.t [new file with mode: 0644]
t/sq-brackets.t [new file with mode: 0644]
t/storable.t
uri-test
xt/author/pod-spell.t
xt/release/changes_has_content.t

diff --git a/Changes b/Changes
index 2e1e59c..aec0ab5 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,8 +1,22 @@
 Revision history for URI
 
+5.12      2022-07-10 23:48:50Z
+    - Fix an issue where i.e. 'file:///tmp/###' was not properly escaped.
+      A non-existing authority part was accidentally processed.
+      Details: https://github.com/libwww-perl/URI/issues/102
+      (GH#102) (Perlbotics)
+    - Reverts to previous behavior (5.10) for 'mailto:' scheme for
+      escaping square brackets.
+
+5.11      2022-07-04 20:53:38Z
+    - Fix some typos in URI::file (GH#94) (Olaf Alders)
+    - Escape square brackets in path (GH#100) (Perlbotics)
+    - Fix storable.t (GH#97) (Shoichi Kaji)
+
 5.10      2021-10-25 20:58:42Z
     - Remove Authority section from dist.ini (GH#86) (Olaf Alders)
-    - Make URI::mailto parse subaddresses with + sign correctly (GH#89) (Julien Fiegehenn)
+    - Make URI::mailto parse subaddresses with + sign correctly (GH#89) (Julien
+      Fiegehenn)
 
 5.09      2021-03-03 15:16:47Z
     - Update Business::ISBN version requirements (GH#85) (brian d foy and Olaf
index 1d7197c..e1f2efb 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,4 +1,4 @@
-# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.024.
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.025.
 CONTRIBUTING.md
 Changes
 LICENSE
@@ -109,6 +109,8 @@ t/scheme-exceptions.t
 t/sip.t
 t/sort-hash-query-form.t
 t/split.t
+t/sq-brackets-legacy.t
+t/sq-brackets.t
 t/storable-test.pl
 t/storable.t
 t/urn-isbn.t
index 2104e72..9e825ec 100644 (file)
--- a/META.json
+++ b/META.json
@@ -4,7 +4,7 @@
       "Gisle Aas <gisle@activestate.com>"
    ],
    "dynamic_config" : 0,
-   "generated_by" : "Dist::Zilla version 6.024, CPAN::Meta::Converter version 2.150010",
+   "generated_by" : "Dist::Zilla version 6.025, CPAN::Meta::Converter version 2.150010",
    "license" : [
       "perl_5"
    ],
@@ -70,7 +70,8 @@
             "warnings" : "0"
          },
          "suggests" : {
-            "Business::ISBN" : "3.005"
+            "Business::ISBN" : "3.005",
+            "Regexp::IPv6" : "0.03"
          }
       },
       "test" : {
    "provides" : {
       "URI" : {
          "file" : "lib/URI.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::Escape" : {
          "file" : "lib/URI/Escape.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::Heuristic" : {
          "file" : "lib/URI/Heuristic.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::IRI" : {
          "file" : "lib/URI/IRI.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::QueryParam" : {
          "file" : "lib/URI/QueryParam.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::Split" : {
          "file" : "lib/URI/Split.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::URL" : {
          "file" : "lib/URI/URL.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::WithBase" : {
          "file" : "lib/URI/WithBase.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::data" : {
          "file" : "lib/URI/data.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::file" : {
          "file" : "lib/URI/file.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::file::Base" : {
          "file" : "lib/URI/file/Base.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::file::FAT" : {
          "file" : "lib/URI/file/FAT.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::file::Mac" : {
          "file" : "lib/URI/file/Mac.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::file::OS2" : {
          "file" : "lib/URI/file/OS2.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::file::QNX" : {
          "file" : "lib/URI/file/QNX.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::file::Unix" : {
          "file" : "lib/URI/file/Unix.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::file::Win32" : {
          "file" : "lib/URI/file/Win32.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::ftp" : {
          "file" : "lib/URI/ftp.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::gopher" : {
          "file" : "lib/URI/gopher.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::http" : {
          "file" : "lib/URI/http.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::https" : {
          "file" : "lib/URI/https.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::ldap" : {
          "file" : "lib/URI/ldap.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::ldapi" : {
          "file" : "lib/URI/ldapi.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::ldaps" : {
          "file" : "lib/URI/ldaps.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::mailto" : {
          "file" : "lib/URI/mailto.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::mms" : {
          "file" : "lib/URI/mms.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::news" : {
          "file" : "lib/URI/news.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::nntp" : {
          "file" : "lib/URI/nntp.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::nntps" : {
          "file" : "lib/URI/nntps.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::pop" : {
          "file" : "lib/URI/pop.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::rlogin" : {
          "file" : "lib/URI/rlogin.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::rsync" : {
          "file" : "lib/URI/rsync.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::rtsp" : {
          "file" : "lib/URI/rtsp.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::rtspu" : {
          "file" : "lib/URI/rtspu.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::sftp" : {
          "file" : "lib/URI/sftp.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::sip" : {
          "file" : "lib/URI/sip.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::sips" : {
          "file" : "lib/URI/sips.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::snews" : {
          "file" : "lib/URI/snews.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::ssh" : {
          "file" : "lib/URI/ssh.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::telnet" : {
          "file" : "lib/URI/telnet.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::tn3270" : {
          "file" : "lib/URI/tn3270.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::urn" : {
          "file" : "lib/URI/urn.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::urn::isbn" : {
          "file" : "lib/URI/urn/isbn.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       },
       "URI::urn::oid" : {
          "file" : "lib/URI/urn/oid.pm",
-         "version" : "5.10"
+         "version" : "5.12"
       }
    },
    "release_status" : "stable",
       "x_IRC" : "irc://irc.perl.org/#lwp",
       "x_MailingList" : "mailto:libwww@perl.org"
    },
-   "version" : "5.10",
+   "version" : "5.12",
    "x_Dist_Zilla" : {
       "perl" : {
-         "version" : "5.030002"
+         "version" : "5.036000"
       },
       "plugins" : [
          {
          {
             "class" : "Dist::Zilla::Plugin::Encoding",
             "name" : "Encoding",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaConfig",
             "name" : "MetaConfig",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaProvides::Package",
                      {
                         "class" : "Dist::Zilla::Plugin::FinderCode",
                         "name" : "MetaProvides::Package/AUTOVIV/:InstallModulesPM",
-                        "version" : "6.024"
+                        "version" : "6.025"
                      }
                   ],
                   "include_underscores" : 0
          {
             "class" : "Dist::Zilla::Plugin::MetaNoIndex",
             "name" : "MetaNoIndex",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaYAML",
             "name" : "MetaYAML",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaJSON",
             "name" : "MetaJSON",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaResources",
             "name" : "MetaResources",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::Git::Contributors",
             "config" : {
                "Dist::Zilla::Plugin::Git::Contributors" : {
-                  "git_version" : "2.33.1",
+                  "git_version" : "2.37.0",
                   "include_authors" : 0,
                   "include_releaser" : 1,
                   "order_by" : "commits",
          {
             "class" : "Dist::Zilla::Plugin::Manifest",
             "name" : "Manifest",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::License",
             "name" : "License",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::ExecDir",
             "name" : "ExecDir",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::Prereqs::FromCPANfile",
          {
             "class" : "Dist::Zilla::Plugin::Readme",
             "name" : "Readme",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::MakeMaker",
             "config" : {
                "Dist::Zilla::Role::TestRunner" : {
-                  "default_jobs" : "1"
+                  "default_jobs" : "8"
                }
             },
             "name" : "MakeMaker",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::CheckChangesHasContent",
          {
             "class" : "Dist::Zilla::Plugin::MetaTests",
             "name" : "MetaTests",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::Test::ChangesHasContent",
          {
             "class" : "Dist::Zilla::Plugin::PodSyntaxTests",
             "name" : "PodSyntaxTests",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable",
                   "changelog" : "Changes"
                },
                "Dist::Zilla::Role::Git::Repo" : {
-                  "git_version" : "2.33.1",
+                  "git_version" : "2.37.0",
                   "repo_root" : "."
                }
             },
             "class" : "Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts",
             "config" : {
                "Dist::Zilla::Role::Git::Repo" : {
-                  "git_version" : "2.33.1",
+                  "git_version" : "2.37.0",
                   "repo_root" : "."
                }
             },
             "class" : "Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch",
             "config" : {
                "Dist::Zilla::Role::Git::Repo" : {
-                  "git_version" : "2.33.1",
+                  "git_version" : "2.37.0",
                   "repo_root" : "."
                }
             },
          {
             "class" : "Dist::Zilla::Plugin::TestRelease",
             "name" : "TestRelease",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::RunExtraTests",
             "config" : {
                "Dist::Zilla::Role::TestRunner" : {
-                  "default_jobs" : "1"
+                  "default_jobs" : "8"
                }
             },
             "name" : "RunExtraTests",
          {
             "class" : "Dist::Zilla::Plugin::UploadToCPAN",
             "name" : "UploadToCPAN",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod",
                }
             },
             "name" : "@Git::VersionManager/pluginbundle version",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::VersionFromMainModule",
                   "changelog" : "Changes"
                },
                "Dist::Zilla::Role::Git::Repo" : {
-                  "git_version" : "2.33.1",
+                  "git_version" : "2.37.0",
                   "repo_root" : "."
                },
                "Dist::Zilla::Role::Git::StringFormatter" : {
                   "branch" : null,
                   "changelog" : "Changes",
                   "signed" : 0,
-                  "tag" : "v5.10",
+                  "tag" : "v5.12",
                   "tag_format" : "v%V",
                   "tag_message" : "v%V"
                },
                "Dist::Zilla::Role::Git::Repo" : {
-                  "git_version" : "2.33.1",
+                  "git_version" : "2.37.0",
                   "repo_root" : "."
                },
                "Dist::Zilla::Role::Git::StringFormatter" : {
          {
             "class" : "Dist::Zilla::Plugin::NextRelease",
             "name" : "@Git::VersionManager/NextRelease",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::Git::Commit",
                   "changelog" : "Changes"
                },
                "Dist::Zilla::Role::Git::Repo" : {
-                  "git_version" : "2.33.1",
+                  "git_version" : "2.37.0",
                   "repo_root" : "."
                },
                "Dist::Zilla::Role::Git::StringFormatter" : {
                   "remotes_must_exist" : 1
                },
                "Dist::Zilla::Role::Git::Repo" : {
-                  "git_version" : "2.33.1",
+                  "git_version" : "2.37.0",
                   "repo_root" : "."
                }
             },
          {
             "class" : "Dist::Zilla::Plugin::ConfirmRelease",
             "name" : "ConfirmRelease",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":InstallModules",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":IncModules",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":TestFiles",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":ExtraTestFiles",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":ExecFiles",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":PerlExecFiles",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":ShareFiles",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":MainModule",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":AllFiles",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":NoFiles",
-            "version" : "6.024"
+            "version" : "6.025"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : "MetaProvides::Package/AUTOVIV/:InstallModulesPM",
-            "version" : "6.024"
+            "version" : "6.025"
          }
       ],
       "zilla" : {
          "config" : {
             "is_trial" : 0
          },
-         "version" : "6.024"
+         "version" : "6.025"
       }
    },
    "x_contributors" : [
       "Ville Skytt\u00e4 <ville.skytta@iki.fi>",
       "Mark Stosberg <mark@stosberg.com>",
       "Michael G. Schwern <schwern@pobox.com>",
-      "Julien Fiegehenn <simbabque@cpan.org>",
       "Shoichi Kaji <skaji@cpan.org>",
+      "Julien Fiegehenn <simbabque@cpan.org>",
+      "Perlbotics <perlbotix@cpan.org>",
       "Slaven Rezic <slaven@rezic.de>",
       "Adam Herzog <adam@adamherzog.com>",
       "Alex Kapranoff <kapranoff@gmail.com>",
       "Tatsuhiko Miyagawa <miyagawa@bulknews.net>",
       "Torsten F\u00f6rtsch <torsten.foertsch@gmx.net>"
    ],
-   "x_generated_by_perl" : "v5.30.2",
-   "x_serialization_backend" : "Cpanel::JSON::XS version 4.26",
+   "x_generated_by_perl" : "v5.36.0",
+   "x_serialization_backend" : "Cpanel::JSON::XS version 4.29",
    "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later"
 }
 
index 101ed90..cc4b518 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -14,7 +14,7 @@ build_requires:
 configure_requires:
   ExtUtils::MakeMaker: '0'
 dynamic_config: 0
-generated_by: 'Dist::Zilla version 6.024, CPAN::Meta::Converter version 2.150010'
+generated_by: 'Dist::Zilla version 6.025, CPAN::Meta::Converter version 2.150010'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -27,136 +27,136 @@ no_index:
 provides:
   URI:
     file: lib/URI.pm
-    version: '5.10'
+    version: '5.12'
   URI::Escape:
     file: lib/URI/Escape.pm
-    version: '5.10'
+    version: '5.12'
   URI::Heuristic:
     file: lib/URI/Heuristic.pm
-    version: '5.10'
+    version: '5.12'
   URI::IRI:
     file: lib/URI/IRI.pm
-    version: '5.10'
+    version: '5.12'
   URI::QueryParam:
     file: lib/URI/QueryParam.pm
-    version: '5.10'
+    version: '5.12'
   URI::Split:
     file: lib/URI/Split.pm
-    version: '5.10'
+    version: '5.12'
   URI::URL:
     file: lib/URI/URL.pm
-    version: '5.10'
+    version: '5.12'
   URI::WithBase:
     file: lib/URI/WithBase.pm
-    version: '5.10'
+    version: '5.12'
   URI::data:
     file: lib/URI/data.pm
-    version: '5.10'
+    version: '5.12'
   URI::file:
     file: lib/URI/file.pm
-    version: '5.10'
+    version: '5.12'
   URI::file::Base:
     file: lib/URI/file/Base.pm
-    version: '5.10'
+    version: '5.12'
   URI::file::FAT:
     file: lib/URI/file/FAT.pm
-    version: '5.10'
+    version: '5.12'
   URI::file::Mac:
     file: lib/URI/file/Mac.pm
-    version: '5.10'
+    version: '5.12'
   URI::file::OS2:
     file: lib/URI/file/OS2.pm
-    version: '5.10'
+    version: '5.12'
   URI::file::QNX:
     file: lib/URI/file/QNX.pm
-    version: '5.10'
+    version: '5.12'
   URI::file::Unix:
     file: lib/URI/file/Unix.pm
-    version: '5.10'
+    version: '5.12'
   URI::file::Win32:
     file: lib/URI/file/Win32.pm
-    version: '5.10'
+    version: '5.12'
   URI::ftp:
     file: lib/URI/ftp.pm
-    version: '5.10'
+    version: '5.12'
   URI::gopher:
     file: lib/URI/gopher.pm
-    version: '5.10'
+    version: '5.12'
   URI::http:
     file: lib/URI/http.pm
-    version: '5.10'
+    version: '5.12'
   URI::https:
     file: lib/URI/https.pm
-    version: '5.10'
+    version: '5.12'
   URI::ldap:
     file: lib/URI/ldap.pm
-    version: '5.10'
+    version: '5.12'
   URI::ldapi:
     file: lib/URI/ldapi.pm
-    version: '5.10'
+    version: '5.12'
   URI::ldaps:
     file: lib/URI/ldaps.pm
-    version: '5.10'
+    version: '5.12'
   URI::mailto:
     file: lib/URI/mailto.pm
-    version: '5.10'
+    version: '5.12'
   URI::mms:
     file: lib/URI/mms.pm
-    version: '5.10'
+    version: '5.12'
   URI::news:
     file: lib/URI/news.pm
-    version: '5.10'
+    version: '5.12'
   URI::nntp:
     file: lib/URI/nntp.pm
-    version: '5.10'
+    version: '5.12'
   URI::nntps:
     file: lib/URI/nntps.pm
-    version: '5.10'
+    version: '5.12'
   URI::pop:
     file: lib/URI/pop.pm
-    version: '5.10'
+    version: '5.12'
   URI::rlogin:
     file: lib/URI/rlogin.pm
-    version: '5.10'
+    version: '5.12'
   URI::rsync:
     file: lib/URI/rsync.pm
-    version: '5.10'
+    version: '5.12'
   URI::rtsp:
     file: lib/URI/rtsp.pm
-    version: '5.10'
+    version: '5.12'
   URI::rtspu:
     file: lib/URI/rtspu.pm
-    version: '5.10'
+    version: '5.12'
   URI::sftp:
     file: lib/URI/sftp.pm
-    version: '5.10'
+    version: '5.12'
   URI::sip:
     file: lib/URI/sip.pm
-    version: '5.10'
+    version: '5.12'
   URI::sips:
     file: lib/URI/sips.pm
-    version: '5.10'
+    version: '5.12'
   URI::snews:
     file: lib/URI/snews.pm
-    version: '5.10'
+    version: '5.12'
   URI::ssh:
     file: lib/URI/ssh.pm
-    version: '5.10'
+    version: '5.12'
   URI::telnet:
     file: lib/URI/telnet.pm
-    version: '5.10'
+    version: '5.12'
   URI::tn3270:
     file: lib/URI/tn3270.pm
-    version: '5.10'
+    version: '5.12'
   URI::urn:
     file: lib/URI/urn.pm
-    version: '5.10'
+    version: '5.12'
   URI::urn::isbn:
     file: lib/URI/urn/isbn.pm
-    version: '5.10'
+    version: '5.12'
   URI::urn::oid:
     file: lib/URI/urn/oid.pm
-    version: '5.10'
+    version: '5.12'
 requires:
   Carp: '0'
   Cwd: '0'
@@ -180,10 +180,10 @@ resources:
   bugtracker: https://github.com/libwww-perl/URI/issues
   homepage: https://github.com/libwww-perl/URI
   repository: https://github.com/libwww-perl/URI.git
-version: '5.10'
+version: '5.12'
 x_Dist_Zilla:
   perl:
-    version: '5.030002'
+    version: '5.036000'
   plugins:
     -
       class: Dist::Zilla::Plugin::Git::GatherDir
@@ -209,11 +209,11 @@ x_Dist_Zilla:
     -
       class: Dist::Zilla::Plugin::Encoding
       name: Encoding
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::MetaConfig
       name: MetaConfig
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::MetaProvides::Package
       config:
@@ -222,13 +222,13 @@ x_Dist_Zilla:
             -
               class: Dist::Zilla::Plugin::FinderCode
               name: MetaProvides::Package/AUTOVIV/:InstallModulesPM
-              version: '6.024'
+              version: '6.025'
           include_underscores: 0
         Dist::Zilla::Role::MetaProvider::Provider:
           $Dist::Zilla::Role::MetaProvider::Provider::VERSION: '2.002004'
           inherit_missing: '0'
           inherit_version: '0'
-          meta_noindex: '1'
+          meta_noindex: 1
         Dist::Zilla::Role::ModuleMetadata:
           Module::Metadata: '1.000037'
           version: '0.006'
@@ -237,24 +237,24 @@ x_Dist_Zilla:
     -
       class: Dist::Zilla::Plugin::MetaNoIndex
       name: MetaNoIndex
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::MetaYAML
       name: MetaYAML
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::MetaJSON
       name: MetaJSON
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::MetaResources
       name: MetaResources
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::Git::Contributors
       config:
         Dist::Zilla::Plugin::Git::Contributors:
-          git_version: 2.33.1
+          git_version: 2.37.0
           include_authors: 0
           include_releaser: 1
           order_by: commits
@@ -268,15 +268,15 @@ x_Dist_Zilla:
     -
       class: Dist::Zilla::Plugin::Manifest
       name: Manifest
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::License
       name: License
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::ExecDir
       name: ExecDir
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::Prereqs::FromCPANfile
       name: Prereqs::FromCPANfile
@@ -284,14 +284,14 @@ x_Dist_Zilla:
     -
       class: Dist::Zilla::Plugin::Readme
       name: Readme
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::MakeMaker
       config:
         Dist::Zilla::Role::TestRunner:
-          default_jobs: '1'
+          default_jobs: '8'
       name: MakeMaker
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::CheckChangesHasContent
       name: CheckChangesHasContent
@@ -336,7 +336,7 @@ x_Dist_Zilla:
     -
       class: Dist::Zilla::Plugin::MetaTests
       name: MetaTests
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::Test::ChangesHasContent
       name: Test::ChangesHasContent
@@ -355,7 +355,7 @@ x_Dist_Zilla:
     -
       class: Dist::Zilla::Plugin::PodSyntaxTests
       name: PodSyntaxTests
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable
       name: Test::Pod::Coverage::Configurable
@@ -406,7 +406,7 @@ x_Dist_Zilla:
           allow_dirty_match: []
           changelog: Changes
         Dist::Zilla::Role::Git::Repo:
-          git_version: 2.33.1
+          git_version: 2.37.0
           repo_root: .
       name: Git::Check
       version: '2.048'
@@ -414,7 +414,7 @@ x_Dist_Zilla:
       class: Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts
       config:
         Dist::Zilla::Role::Git::Repo:
-          git_version: 2.33.1
+          git_version: 2.37.0
           repo_root: .
       name: Git::CheckFor::MergeConflicts
       version: '0.014'
@@ -422,7 +422,7 @@ x_Dist_Zilla:
       class: Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch
       config:
         Dist::Zilla::Role::Git::Repo:
-          git_version: 2.33.1
+          git_version: 2.37.0
           repo_root: .
       name: Git::CheckFor::CorrectBranch
       version: '0.014'
@@ -433,18 +433,18 @@ x_Dist_Zilla:
     -
       class: Dist::Zilla::Plugin::TestRelease
       name: TestRelease
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::RunExtraTests
       config:
         Dist::Zilla::Role::TestRunner:
-          default_jobs: '1'
+          default_jobs: '8'
       name: RunExtraTests
       version: '0.029'
     -
       class: Dist::Zilla::Plugin::UploadToCPAN
       name: UploadToCPAN
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::ReadmeAnyFromPod
       config:
@@ -459,7 +459,7 @@ x_Dist_Zilla:
           phase: develop
           type: recommends
       name: '@Git::VersionManager/pluginbundle version'
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::VersionFromMainModule
       config:
@@ -496,7 +496,7 @@ x_Dist_Zilla:
           allow_dirty_match: []
           changelog: Changes
         Dist::Zilla::Role::Git::Repo:
-          git_version: 2.33.1
+          git_version: 2.37.0
           repo_root: .
         Dist::Zilla::Role::Git::StringFormatter:
           time_zone: local
@@ -509,11 +509,11 @@ x_Dist_Zilla:
           branch: ~
           changelog: Changes
           signed: 0
-          tag: v5.10
+          tag: v5.12
           tag_format: v%V
           tag_message: v%V
         Dist::Zilla::Role::Git::Repo:
-          git_version: 2.33.1
+          git_version: 2.37.0
           repo_root: .
         Dist::Zilla::Role::Git::StringFormatter:
           time_zone: local
@@ -533,7 +533,7 @@ x_Dist_Zilla:
     -
       class: Dist::Zilla::Plugin::NextRelease
       name: '@Git::VersionManager/NextRelease'
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::Git::Commit
       config:
@@ -550,7 +550,7 @@ x_Dist_Zilla:
             - (?^:^lib/.*\.pm$)
           changelog: Changes
         Dist::Zilla::Role::Git::Repo:
-          git_version: 2.33.1
+          git_version: 2.37.0
           repo_root: .
         Dist::Zilla::Role::Git::StringFormatter:
           time_zone: local
@@ -564,63 +564,63 @@ x_Dist_Zilla:
             - origin
           remotes_must_exist: 1
         Dist::Zilla::Role::Git::Repo:
-          git_version: 2.33.1
+          git_version: 2.37.0
           repo_root: .
       name: Git::Push
       version: '2.048'
     -
       class: Dist::Zilla::Plugin::ConfirmRelease
       name: ConfirmRelease
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':InstallModules'
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':IncModules'
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':TestFiles'
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':ExtraTestFiles'
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':ExecFiles'
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':PerlExecFiles'
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':ShareFiles'
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':MainModule'
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':AllFiles'
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':NoFiles'
-      version: '6.024'
+      version: '6.025'
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: MetaProvides::Package/AUTOVIV/:InstallModulesPM
-      version: '6.024'
+      version: '6.025'
   zilla:
     class: Dist::Zilla::Dist::Builder
     config:
-      is_trial: '0'
-    version: '6.024'
+      is_trial: 0
+    version: '6.025'
 x_contributors:
   - 'Gisle Aas <gisle@aas.no>'
   - 'Karen Etheridge <ether@cpan.org>'
@@ -629,8 +629,9 @@ x_contributors:
   - 'Ville Skyttä <ville.skytta@iki.fi>'
   - 'Mark Stosberg <mark@stosberg.com>'
   - 'Michael G. Schwern <schwern@pobox.com>'
-  - 'Julien Fiegehenn <simbabque@cpan.org>'
   - 'Shoichi Kaji <skaji@cpan.org>'
+  - 'Julien Fiegehenn <simbabque@cpan.org>'
+  - 'Perlbotics <perlbotix@cpan.org>'
   - 'Slaven Rezic <slaven@rezic.de>'
   - 'Adam Herzog <adam@adamherzog.com>'
   - 'Alex Kapranoff <kapranoff@gmail.com>'
@@ -652,6 +653,6 @@ x_contributors:
   - 'Salvatore Bonaccorso <carnil@launchpad.net>'
   - 'Tatsuhiko Miyagawa <miyagawa@bulknews.net>'
   - 'Torsten Förtsch <torsten.foertsch@gmx.net>'
-x_generated_by_perl: v5.30.2
+x_generated_by_perl: v5.36.0
 x_serialization_backend: 'YAML::Tiny version 1.73'
 x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later'
index 907da23..e5931d3 100644 (file)
@@ -1,4 +1,4 @@
-# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.024.
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.025.
 use strict;
 use warnings;
 
@@ -43,7 +43,7 @@ my %WriteMakefileArgs = (
     "Test::Needs" => 0,
     "utf8" => 0
   },
-  "VERSION" => "5.10",
+  "VERSION" => "5.12",
   "test" => {
     "TESTS" => "t/*.t"
   }
diff --git a/README b/README
index d7e1809..e94c1d2 100644 (file)
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
 This archive contains the distribution URI,
-version 5.10:
+version 5.12:
 
   Uniform Resource Identifiers (absolute and relative)
 
@@ -9,4 +9,4 @@ This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
 
 
-This README file was generated by Dist::Zilla::Plugin::Readme v6.024.
+This README file was generated by Dist::Zilla::Plugin::Readme v6.025.
index 840e679..7c10d15 100644 (file)
--- a/cpanfile
+++ b/cpanfile
@@ -38,6 +38,7 @@ on 'runtime' => sub {
     requires "strict" => "0";
     requires "warnings" => "0";
     requires "utf8" => '0';
+    suggests 'Regexp::IPv6' => "0.03";
     suggests 'Business::ISBN' => "3.005";
 };
 
index 9cde9dd..edf1580 100644 (file)
@@ -3,7 +3,10 @@ package URI;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
+
+# 1=version 5.10 and earlier; 0=version 5.11 and later
+use constant HAS_RESERVED_SQUARE_BRACKETS => $ENV{URI_HAS_RESERVED_SQUARE_BRACKETS} ? 1 : 0;
 
 our ($ABS_REMOTE_LEADING_DOTS, $ABS_ALLOW_RELATIVE_SCHEME, $DEFAULT_QUERY_FORM_DELIMITER);
 
@@ -11,13 +14,29 @@ my %implements;  # mapping from scheme to implementor class
 
 # Some "official" character classes
 
-our $reserved   = q(;/?:@&=+$,[]);
+our $reserved   = HAS_RESERVED_SQUARE_BRACKETS ? q(;/?:@&=+$,[]) : q(;/?:@&=+$,);
 our $mark       = q(-_.!~*'());                                    #'; emacs
 our $unreserved = "A-Za-z0-9\Q$mark\E";
 our $uric       = quotemeta($reserved) . $unreserved . "%";
+our $uric4host  = $uric . ( HAS_RESERVED_SQUARE_BRACKETS ? '' : quotemeta( q([]) ) );
+our $uric4user  = quotemeta( q{!$'()*,;:._~%-+=%&} ) . "A-Za-z0-9" . ( HAS_RESERVED_SQUARE_BRACKETS ? quotemeta( q([]) ) : '' ); # RFC-3987: iuserinfo w/o UTF
 
 our $scheme_re  = '[a-zA-Z][a-zA-Z0-9.+\-]*';
 
+# These schemes don't have an IPv6+ address part.
+our $schemes_without_host_part_re = 'data|ldapi|urn|sqlite|sqlite3';
+
+# These schemes can have an IPv6+ authority part:
+#     file, ftp, gopher, http, https, ldap, ldaps, mms, news, nntp, nntps, pop, rlogin, rtsp, rtspu, rsync, sip, sips, snews,
+#     telnet, tn3270, ssh, sftp
+#     (all DB URIs, i.e. cassandra, couch, couchdb, etc.), except 'sqlite:', 'sqlite3:'. Others?
+#MAINT: URI has no test coverage for DB schemes
+#MAINT: decoupling - perhaps let each class decide itself by defining a member function 'scheme_has_authority_part()'?
+
+#MAINT: 'mailto:' needs special treatment for IPv* addresses / RFC 5321 (4.1.3). Until then: restore all '[', ']'
+# These schemes need fallback to previous (<= 5.10) encoding until a specific handler is available.
+our $fallback_schemes_re = 'mailto';
+
 use Carp ();
 use URI::Escape ();
 
@@ -86,10 +105,42 @@ sub _init
 }
 
 
+#-- Version: 5.11+
+#   Since the complete URI will be percent-encoded including '[' and ']',
+#   we selectively unescape square brackets from the authority/host part of the URI.
+#   Derived modules that implement _uric_escape() should take this into account
+#   if they do not rely on URI::_uric_escape().
+#   No unescaping is performed for the userinfo@ part of the authority part.
+sub _fix_uric_escape_for_host_part {
+  return if HAS_RESERVED_SQUARE_BRACKETS;
+  return if $_[0] !~ /%/;
+  return if $_[0] =~ m{^(?:$URI::schemes_without_host_part_re):}os;
+
+  # until a scheme specific handler is available, fall back to previous behavior of v5.10 (i.e. 'mailto:')
+  if ($_[0] =~ m{^(?:$URI::fallback_schemes_re):}os) {
+    $_[0]    =~ s/\%5B/[/gi;
+    $_[0]    =~ s/\%5D/]/gi;
+    return;
+  }
+
+  if ($_[0] =~ m{^((?:$URI::scheme_re:)?)//([^/?\#]+)(.*)$}os) {
+    my $orig          = $2;
+    my ($user, $host) = $orig =~ /^(.*@)?([^@]*)$/;
+    $user  ||= '';
+    my $port = $host =~ s/(:\d+)$// ? $1 : '';
+    #MAINT: die() here if scheme indicates TCP/UDP and port is out of range [0..65535] ?
+    $host    =~ s/\%5B/[/gi;
+    $host    =~ s/\%5D/]/gi;
+    $_[0]    =~ s/\Q$orig\E/$user$host$port/;
+  }
+}
+
+
 sub _uric_escape
 {
     my($class, $str) = @_;
     $str =~ s*([^$uric\#])* URI::Escape::escape_char($1) *ego;
+    _fix_uric_escape_for_host_part( $str );
     utf8::downgrade($str);
     return $str;
 }
@@ -1087,6 +1138,34 @@ delimited by ";" instead of "&" which is the default.
 
 =back
 
+=head1 ENVIRONMENT VARIABLES
+
+=over 4
+
+=item URI_HAS_RESERVED_SQUARE_BRACKETS
+
+Before version 5.11, URI treated square brackets as reserved characters
+throughout the whole URI string. However, these brackets are reserved
+only within the authority/host part of the URI and nowhere else (RFC 3986).
+
+Starting with version 5.11, URI takes this distinction into account.
+Setting the environment variable C<URI_HAS_RESERVED_SQUARE_BRACKETS>
+(programmatically or via the shell), restores the old behavior.
+
+  #-- restore 5.10 behavior programmatically
+  BEGIN {
+    $ENV{URI_HAS_RESERVED_SQUARE_BRACKETS} = 1;
+  }
+  use URI ();
+
+I<Note>: This environment variable is just used during initialization and has to be set
+      I<before> module URI is used/required. Changing it at run time has no effect.
+
+Its value can be checked programmatically by accessing the constant
+C<URI::HAS_RESERVED_SQUARE_BRACKETS>.
+
+=back
+
 =head1 BUGS
 
 There are some things that are not quite right:
index 5760bb5..8b53bda 100644 (file)
@@ -141,7 +141,7 @@ use Exporter 5.57 'import';
 our %escapes;
 our @EXPORT = qw(uri_escape uri_unescape uri_escape_utf8);
 our @EXPORT_OK = qw(%escapes);
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use Carp ();
 
index f2637a0..088cd80 100644 (file)
@@ -91,7 +91,7 @@ use warnings;
 
 use Exporter 5.57 'import';
 our @EXPORT_OK = qw(uf_uri uf_uristr uf_url uf_urlstr);
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 our ($MY_COUNTRY, $DEBUG);
 
index fd185a9..770a5cb 100644 (file)
@@ -8,7 +8,7 @@ use URI ();
 
 use overload '""' => sub { shift->as_string };
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 sub new {
     my($class, $uri, $scheme) = @_;
index c7ff25e..93742d5 100644 (file)
@@ -3,7 +3,7 @@ package URI::QueryParam;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 sub URI::_query::query_param {
     my $self = shift;
index b31d828..e468551 100644 (file)
@@ -3,7 +3,7 @@ package URI::Split;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use Exporter 5.57 'import';
 our @EXPORT_OK = qw(uri_split uri_join);
index 9591e9e..daef33f 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 
 use parent 'URI::WithBase';
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 # Provide as much as possible of the old URI::URL interface for backwards
 # compatibility...
index 76c331b..32e6b3d 100644 (file)
@@ -6,7 +6,7 @@ use warnings;
 use URI ();
 use Scalar::Util qw(blessed);
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use overload '""' => "as_string", fallback => 1;
 
index bc44f4a..7d9474d 100644 (file)
@@ -5,6 +5,6 @@ use warnings;
 
 use parent 'URI::_generic';
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 1;
index 9ff33b2..3540c66 100644 (file)
@@ -8,13 +8,33 @@ use parent qw(URI URI::_query);
 use URI::Escape qw(uri_unescape);
 use Carp ();
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
-my $ACHAR = $URI::uric;  $ACHAR =~ s,\\[/?],,g;
-my $PCHAR = $URI::uric;  $PCHAR =~ s,\\[?],,g;
+my $ACHAR = URI::HAS_RESERVED_SQUARE_BRACKETS ? $URI::uric : $URI::uric4host;  $ACHAR =~ s,\\[/?],,g;
+my $PCHAR = $URI::uric;                                                        $PCHAR =~ s,\\[?],,g;
 
 sub _no_scheme_ok { 1 }
 
+our $IPv6_re;
+
+sub _looks_like_raw_ip6_address {
+  my $addr = shift;
+
+  if ( !$IPv6_re ) { #-- lazy / runs once / use Regexp::IPv6 if installed
+    eval {
+      require Regexp::IPv6;
+      Regexp::IPv6->import( qw($IPv6_re) );
+      1;
+    }  ||  do { $IPv6_re = qr/[:0-9a-f]{3,}/; }; #-- fallback: unambitious guess
+  }
+
+  return 0 unless $addr;
+  return 0 if $addr =~ tr/:/:/ < 2;  #-- fallback must not create false positive for IPv4:Port = 0:0
+  return 1 if $addr =~ /^$IPv6_re$/i;
+  return 0;
+}
+
+
 sub authority
 {
     my $self = shift;
@@ -26,6 +46,13 @@ sub authority
        my $rest = $3;
        if (defined $auth) {
            $auth =~ s/([^$ACHAR])/ URI::Escape::escape_char($1)/ego;
+            if ( my ($user, $host) = $auth =~ /^(.*@)?([^@]+)$/ ) { #-- special escape userinfo part
+              $user ||= '';
+              $user =~ s/([^$URI::uric4user])/ URI::Escape::escape_char($1)/ego;
+              $user =~ s/%40$/\@/; # recover final '@'
+              $host = "[$host]" if _looks_like_raw_ip6_address( $host );
+              $auth = $user . $host;
+            }
            utf8::downgrade($auth);
            $$self .= "//$auth";
        }
index 4292d3e..52f7748 100644 (file)
@@ -9,7 +9,7 @@ use warnings;
 use URI::_punycode qw(decode_punycode encode_punycode);
 use Carp qw(croak);
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 BEGIN {
   *URI::_idna::_ENV_::JOIN_LEAKS_UTF8_FLAGS = "$]" < 5.008_003
index 43193b4..62ccf89 100644 (file)
@@ -7,7 +7,7 @@ package URI::_ldap;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use URI::Escape qw(uri_unescape);
 
index c3d0583..849938e 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 
 use parent qw(URI::_server URI::_userpass);
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 # Generic terminal logins.  This is used as a base class for 'telnet',
 # 'tn3270', and 'rlogin' URL schemes.
index eeb3662..cd0982a 100644 (file)
@@ -3,7 +3,7 @@ package URI::_punycode;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use Exporter 'import';
 our @EXPORT = qw(encode_punycode decode_punycode);
index b9b70c4..f3645dc 100644 (file)
@@ -6,7 +6,7 @@ use warnings;
 use URI ();
 use URI::Escape qw(uri_unescape);
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 sub query
 {
index 364ca48..5e4d477 100644 (file)
@@ -11,7 +11,7 @@ use URI::Escape qw(uri_unescape);
 use overload '""' => sub { $_[0]->[0] },
              fallback => 1;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 sub new
 {
index fec55a4..dcbf9fd 100644 (file)
@@ -7,7 +7,7 @@ use parent 'URI::_generic';
 
 use URI::Escape qw(uri_unescape);
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 sub _uric_escape {
     my($class, $str) = @_;
@@ -23,7 +23,8 @@ sub _uric_escape {
 }
 
 sub _host_escape {
-    return unless $_[0] =~ /[^$URI::uric]/;
+  return if  URI::HAS_RESERVED_SQUARE_BRACKETS  and  $_[0] !~ /[^$URI::uric]/;
+  return if !URI::HAS_RESERVED_SQUARE_BRACKETS  and  $_[0] !~ /[^$URI::uric4host]/;
     eval {
        require URI::_idna;
        $_[0] = URI::_idna::encode($_[0]);
@@ -59,8 +60,8 @@ sub userinfo
        $new =~ s/.*@//;  # remove old stuff
        my $ui = shift;
        if (defined $ui) {
-           $ui =~ s/@/%40/g;   # protect @
-           $new = "$ui\@$new";
+          $ui =~ s/([^$URI::uric4user])/ URI::Escape::escape_char($1)/ego;
+          $new = "$ui\@$new";
        }
        $self->authority($new);
     }
index acf5717..bc20923 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 
 use URI::Escape qw(uri_unescape);
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 sub user
 {
index 666ef38..0f62b73 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 
 use parent 'URI';
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use MIME::Base64 qw(decode_base64 encode_base64);
 use URI::Escape qw(uri_unescape);
index c9973ec..f5bda1e 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 
 use parent 'URI::_generic';
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use URI::Escape qw(uri_unescape);
 
@@ -113,13 +113,13 @@ URI::file - URI that maps to local file names
 =head1 SYNOPSIS
 
  use URI::file;
+
  $u1 = URI->new("file:/foo/bar");
  $u2 = URI->new("foo/bar", "file");
+
  $u3 = URI::file->new($path);
  $u4 = URI::file->new("c:\\windows\\", "win32");
+
  $u1->file;
  $u1->file("mac");
 
@@ -301,11 +301,11 @@ If there is no mapping then the "Unix" implementation is used.
 
 =item $URI::file::DEFAULT_AUTHORITY
 
-This determine what "authority" string to include in absolute file
+This determines what "authority" string to include in absolute file
 URIs.  It defaults to "".  If you prefer verbose URIs you might set it
 to be "localhost".
 
-Setting this value to C<undef> force behaviour compatible to URI v1.31
+Setting this value to C<undef> forces behaviour compatible to URI v1.31
 and earlier.  In this mode host names in UNC paths and drive letters
 are mapped to the authority component on Windows, while we produce
 authority-less URIs on Unix.
index 5192f33..38e5bed 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 
 use URI::Escape ();
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 sub new
 {
index 521c3a0..332db32 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 
 use parent 'URI::file::Win32';
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 sub fix_path
 {
index ee7bf57..9282438 100644 (file)
@@ -7,7 +7,7 @@ use parent 'URI::file::Base';
 
 use URI::Escape qw(uri_unescape);
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 sub _file_extract_path
 {
index 14ec915..2e33142 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 
 use parent 'URI::file::Win32';
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 # The Win32 version translates k:/foo to file://k:/foo  (?!)
 # We add an empty host
index cb47809..7f09411 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 
 use parent 'URI::file::Unix';
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 sub _file_extract_path
 {
index fa226f7..8eb9dfa 100644 (file)
@@ -7,7 +7,7 @@ use parent 'URI::file::Base';
 
 use URI::Escape qw(uri_unescape);
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 sub _file_extract_path
 {
index bc1b373..3e09913 100644 (file)
@@ -7,7 +7,7 @@ use parent 'URI::file::Base';
 
 use URI::Escape qw(uri_unescape);
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 sub _file_extract_authority
 {
index a6c12df..0396af4 100644 (file)
@@ -3,7 +3,7 @@ package URI::ftp;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent qw(URI::_server URI::_userpass);
 
index febd95c..ee2ae37 100644 (file)
@@ -3,7 +3,7 @@ package URI::gopher;  # <draft-murali-url-gopher>, Dec 4, 1996
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI::_server';
 
index 50a09f0..455bc0f 100644 (file)
@@ -3,7 +3,7 @@ package URI::http;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI::_server';
 
index e3283e5..1610765 100644 (file)
@@ -3,7 +3,7 @@ package URI::https;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI::http';
 
index 2977954..75b3bbf 100644 (file)
@@ -7,7 +7,7 @@ package URI::ldap;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent qw(URI::_ldap URI::_server);
 
index e3bac5a..e91265e 100644 (file)
@@ -3,7 +3,7 @@ package URI::ldapi;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent qw(URI::_ldap URI::_generic);
 
index 4d58c67..581d991 100644 (file)
@@ -3,7 +3,7 @@ package URI::ldaps;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI::ldap';
 
index 5d6f241..0e40a5b 100644 (file)
@@ -3,7 +3,7 @@ package URI::mailto;  # RFC 2368
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent qw(URI URI::_query);
 
index 6a41297..4c7aa4f 100644 (file)
@@ -3,7 +3,7 @@ package URI::mms;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI::http';
 
index 4092981..dc8e973 100644 (file)
@@ -3,7 +3,7 @@ package URI::news;  # draft-gilman-news-url-01
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI::_server';
 
index be27689..67128c5 100644 (file)
@@ -3,7 +3,7 @@ package URI::nntp;  # draft-gilman-news-url-01
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI::news';
 
index a10e992..82e6125 100644 (file)
@@ -3,7 +3,7 @@ package URI::nntps;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI::nntp';
 
index accab91..c0287b4 100644 (file)
@@ -3,7 +3,7 @@ package URI::pop;   # RFC 2384
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI::_server';
 
index 049ff4a..2c712be 100644 (file)
@@ -3,7 +3,7 @@ package URI::rlogin;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI::_login';
 
index 164c6b7..2381e26 100644 (file)
@@ -5,7 +5,7 @@ package URI::rsync;  # http://rsync.samba.org/
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent qw(URI::_server URI::_userpass);
 
index 48429f7..27d34bb 100644 (file)
@@ -3,7 +3,7 @@ package URI::rtsp;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI::http';
 
index c9bc64d..bad4944 100644 (file)
@@ -3,7 +3,7 @@ package URI::rtspu;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI::rtsp';
 
index 4c9a1f3..3fa3932 100644 (file)
@@ -5,6 +5,6 @@ use warnings;
 
 use parent 'URI::ssh';
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 1;
index a6aeb85..a5fe04d 100644 (file)
@@ -14,7 +14,7 @@ use parent qw(URI::_server URI::_userpass);
 
 use URI::Escape ();
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 sub default_port { 5060 }
 
index 3d7c2f2..aff86a4 100644 (file)
@@ -3,7 +3,7 @@ package URI::sips;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI::sip';
 
index e541482..8ae54f8 100644 (file)
@@ -3,7 +3,7 @@ package URI::snews;  # draft-gilman-news-url-01
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI::news';
 
index 7273c2b..9cb1347 100644 (file)
@@ -3,7 +3,7 @@ package URI::ssh;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI::_login';
 
index 5d81650..ba746c9 100644 (file)
@@ -3,7 +3,7 @@ package URI::telnet;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI::_login';
 
index 53a3414..062a508 100644 (file)
@@ -3,7 +3,7 @@ package URI::tn3270;
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI::_login';
 
index 75f3a9b..459759a 100644 (file)
@@ -3,7 +3,7 @@ package URI::urn;  # RFC 2141
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI';
 
index 4986d70..c5db302 100644 (file)
@@ -3,7 +3,7 @@ package URI::urn::isbn;  # RFC 3187
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI::urn';
 
index 5ba279f..0d9aa90 100644 (file)
@@ -3,7 +3,7 @@ package URI::urn::oid;  # RFC 2061
 use strict;
 use warnings;
 
-our $VERSION = '5.10';
+our $VERSION = '5.12';
 
 use parent 'URI::urn';
 
index a932431..187b2aa 100644 (file)
@@ -49,7 +49,8 @@ do { my $x = {
                                       'warnings' => '0'
                                     },
                       'suggests' => {
-                                      'Business::ISBN' => '3.005'
+                                      'Business::ISBN' => '3.005',
+                                      'Regexp::IPv6' => '0.03'
                                     }
                     },
        'test' => {
index 26e0119..f9273da 100644 (file)
--- a/t/file.t
+++ b/t/file.t
 use strict;
 use warnings;
 
+use Test::More;
 use URI::file;
 
-my @tests =  (
-[ "file",          "unix",       "win32",         "mac" ],
-#----------------  ------------  ---------------  --------------
-[ "file://localhost/foo/bar",
-                  "!/foo/bar",  "!\\foo\\bar",   "!foo:bar", ],
-[ "file:///foo/bar",
-                  "/foo/bar",   "\\foo\\bar",    "!foo:bar", ],
-[ "file:/foo/bar", "!/foo/bar",  "!\\foo\\bar",   "foo:bar", ],
-[ "foo/bar",       "foo/bar",    "foo\\bar",      ":foo:bar",],
-[ "file://foo3445x/bar","!//foo3445x/bar", "!\\\\foo3445x\\bar", "!foo3445x:bar"],
-[ "file://a:/",    "!//a:/",     "!A:\\",         undef],
-[ "file:///A:/",   "/A:/",       "A:\\",          undef],
-[ "file:///",      "/",          "\\",            undef],
-[ ".",             ".",          ".",             ":"],
-[ "..",            "..",         "..",            "::"],
-[ "%2E",           "!.",         "!.",           ":."],
-[ "../%2E%2E",     "!../..",     "!..\\..",      "::.."],
-);
-
-my @os = @{shift @tests};
-shift @os;  # file
-
-my $num = @tests;
-print "1..$num\n";
-
-my $testno = 1;
-
-for my $t (@tests) {
-   my @t = @$t;
-   my $file = shift @t;
-   my $err;
-
-   my $u = URI->new($file, "file");
-   my $i = 0;
-   for my $os (@os) {
-       my $f = $u->file($os);
-       my $expect = $t[$i];
-       $f = "<undef>" unless defined $f;
-       $expect = "<undef>" unless defined $expect;
-       my $loose;
-       $loose++ if $expect =~ s/^!//;
-       if ($expect ne $f) {
-           print "URI->new('$file', 'file')->file('$os') ne $expect, but $f\n";
-           $err++;
-       }
-       if (defined($t[$i]) && !$loose) {
-          my $u2 = URI::file->new($t[$i], $os);
-           unless ($u2->as_string eq $file) {
-              print "URI::file->new('$t[$i]', '$os') ne $file, but $u2\n";
-              $err++;
-           }
-       }
-       $i++;
-   }
-   print "not " if $err;
-   print "ok $testno\n";
-   $testno++;
+
+subtest 'OS related tests (unix, win32, mac)' => sub {
+
+    my @tests = (
+        ["file", "unix", "win32", "mac"],
+
+        #----------------  ------------  ---------------  --------------
+        ["file://localhost/foo/bar", "!/foo/bar", "!\\foo\\bar", "!foo:bar",],
+        ["file:///foo/bar",          "/foo/bar",  "\\foo\\bar",  "!foo:bar",],
+        ["file:/foo/bar",            "!/foo/bar", "!\\foo\\bar", "foo:bar",],
+        ["foo/bar",                  "foo/bar",   "foo\\bar",    ":foo:bar",],
+        [
+            "file://foo3445x/bar", "!//foo3445x/bar",
+            "!\\\\foo3445x\\bar",  "!foo3445x:bar"
+        ],
+        ["file://a:/",  "!//a:/", "!A:\\",   undef],
+        ["file:///A:/", "/A:/",   "A:\\",    undef],
+        ["file:///",    "/",      "\\",      undef],
+        [".",           ".",      ".",       ":"],
+        ["..",          "..",     "..",      "::"],
+        ["%2E",         "!.",     "!.",      ":."],
+        ["../%2E%2E",   "!../..", "!..\\..", "::.."],
+    );
+
+    my @os = @{shift @tests};
+    shift @os;    # file
+
+    for my $t (@tests) {
+        my @t    = @$t;
+        my $file = shift @t;
+        my $u    = URI->new($file, "file");
+        my $i    = 0;
+
+        for my $os (@os) {
+            my $f      = $u->file($os);
+            my $expect = $t[$i];
+            $f      = "<undef>" unless defined $f;
+            $expect = "<undef>" unless defined $expect;
+            my $loose;
+            $loose++ if $expect =~ s/^!//;
+
+            is($f, $expect) or diag "URI->new('$file', 'file')->file('$os')";
+
+            if (defined($t[$i]) && !$loose) {
+                my $u2 = URI::file->new($t[$i], $os);
+                is($u2->as_string, $file)
+                    or diag "URI::file->new('$t[$i]', '$os')";
+            }
+
+            $i++;
+        }
+    }
+
+};
+
+
+SKIP: {
+    skip "No pre 5.11 regression tests yet.", 1
+        if URI::HAS_RESERVED_SQUARE_BRACKETS;
+
+    subtest "Including Domains" => sub {
+
+        is(
+            URI->new('file://example.com/tmp/file.part[1]'),
+            'file://example.com/tmp/file.part%5B1%5D'
+        );
+        is(
+            URI->new('file://127.0.0.1/tmp/file.part[2]'),
+            'file://127.0.0.1/tmp/file.part%5B2%5D'
+        );
+        is(
+            URI->new('file://localhost/tmp/file.part[3]'),
+            'file://localhost/tmp/file.part%5B3%5D'
+        );
+        is(
+            URI->new('file://[1:2:3::beef]/tmp/file.part[4]'),
+            'file://[1:2:3::beef]/tmp/file.part%5B4%5D'
+        );
+        is(
+            URI->new('file:///[1:2:3::1ce]/tmp/file.part[5]'),
+            'file:///%5B1:2:3::1ce%5D/tmp/file.part%5B5%5D'
+        );
+
+    };
+
 }
+
+
+subtest "Regression Tests" => sub {
+
+  # Regression test for https://github.com/libwww-perl/URI/issues/102
+  my $with_hashes = URI::file->new_abs("/tmp/###");
+  is($with_hashes, 'file:///tmp/%23%23%23', "issue GH#102");
+
+};
+
+
+done_testing;
index 683be92..79e9a13 100644 (file)
@@ -55,4 +55,16 @@ TODO: {
     is $u, 'mailto:%22foo%20bar+baz%22@example.com', '... and stringification works';
 }
 
+# RFC 5321 (4.1.3) - Address Literals
+
+# IPv4
+$u = URI->new('mailto:user@[127.0.0.1]');
+is $u->to, 'user@[127.0.0.1]', 'IPv4 host name';
+is $u, 'mailto:user@[127.0.0.1]', '... and stringification works';
+
+# IPv6
+$u = URI->new('mailto:user@[IPv6:fe80::e828:209d:20e:c0ae]');
+is $u->to, 'user@[IPv6:fe80::e828:209d:20e:c0ae]', 'IPv4 host name';
+is $u, 'mailto:user@[IPv6:fe80::e828:209d:20e:c0ae]', '... and stringification works';
+
 done_testing;
index 706051a..bef71eb 100644 (file)
@@ -552,7 +552,13 @@ sub escape_test {
     is($all, $new, "uri_escape->uri_unescape"),
 
     $url->path($all);
-    is($url->full_path, q(%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22%23$%&'()*+,-./0123456789:;%3C=%3E%3F@ABCDEFGHIJKLMNOPQRSTUVWXYZ[%5C]%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF), ref($url) . '->as_string');
+
+    if ( URI::HAS_RESERVED_SQUARE_BRACKETS ) {
+      # legacy: this was legal before '[' and ']' were restricted to the host part of the URI (see: RFC 3513 & RFC 3986)
+      is($url->full_path, q(%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22%23$%&'()*+,-./0123456789:;%3C=%3E%3F@ABCDEFGHIJKLMNOPQRSTUVWXYZ[%5C]%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF), ref($url) . '->as_string');
+    } else {
+      is($url->full_path, q(%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22%23$%&'()*+,-./0123456789:;%3C=%3E%3F@ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF), ref($url) . '->as_string');
+    }
 
     # test escaping uses uppercase (preferred by rfc1837)
     $url = new URI::URL 'file://h/';
diff --git a/t/sq-brackets-legacy.t b/t/sq-brackets-legacy.t
new file mode 100644 (file)
index 0000000..1f5b7dd
--- /dev/null
@@ -0,0 +1,41 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+BEGIN {
+  $ENV{URI_HAS_RESERVED_SQUARE_BRACKETS} = 1;
+}
+
+use URI ();
+
+sub show {
+  diag explain("self: ", shift);
+}
+
+
+#-- test bugfix of https://github.com/libwww-perl/URI/issues/99
+
+
+no warnings; #-- don't complain about the fragment # being a potential comment
+my @legacy_tests = qw(
+                     ftp://[::1]/
+                     http://example.com/path_with_square_[brackets]
+                     http://[::1]/and_[%5Bmixed%5D]_stuff_in_path
+                     https://[::1]/path_with_square_[brackets]_and_query?par=value[1]&par=value[2]
+                     http://[::1]/path_with_square_[brackets]_and_query?par=value[1]#and_fragment[2]
+                     https://root[user]@[::1]/welcome.html
+                    );
+use warnings;
+
+is( URI::HAS_RESERVED_SQUARE_BRACKETS, 1, "constant indicates to treat square brackets as reserved characters (legacy)" );
+
+foreach my $same ( @legacy_tests  ) {
+  my $u = URI->new(  $same );
+  is( $u->canonical,
+      $same,
+      "legacy: reserved square brackets not escaped"
+    ) or show $u;
+}
+
+done_testing;
diff --git a/t/sq-brackets.t b/t/sq-brackets.t
new file mode 100644 (file)
index 0000000..bb5152d
--- /dev/null
@@ -0,0 +1,188 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+BEGIN {
+  $ENV{URI_HAS_RESERVED_SQUARE_BRACKETS} = 0;
+}
+
+use URI ();
+
+sub show {
+  diag explain("self: ", shift);
+}
+
+
+#-- test bugfix of https://github.com/libwww-perl/URI/issues/99
+
+
+is( URI::HAS_RESERVED_SQUARE_BRACKETS, 0, "constant indicates NOT to treat square brackets as reserved characters" );
+
+{
+  my $u = URI->new("http://[::1]/path_with_square_[brackets]?par=value[1]");
+  is( $u->canonical,
+      "http://[::1]/path_with_square_%5Bbrackets%5D?par=value%5B1%5D",
+      "sqb in path and request"
+    ) or show $u;
+}
+
+
+{
+  my $u = URI->new("http://[::1]/path_with_square_[brackets]?par=value[1]#fragment[2]");
+  is( $u->canonical,
+      "http://[::1]/path_with_square_%5Bbrackets%5D?par=value%5B1%5D#fragment%5B2%5D",
+      "sqb in path and request and fragment"
+    ) or show $u;
+}
+
+
+{
+  my $u = URI->new("http://root[user]@[::1]/path_with_square_[brackets]?par=value[1]#fragment[2]");
+  is( $u->canonical,
+      "http://root%5Buser%5D@[::1]/path_with_square_%5Bbrackets%5D?par=value%5B1%5D#fragment%5B2%5D",
+      "sqb in userinfo, host, path, request and fragment"
+    ) or show $u;
+}
+
+
+{
+  my $u = URI->new("http://root[user]@[::1]/path_with_square_[brackets]?par=value[1]&par[2]=value[2]#fragment[2]");
+  is( $u->canonical,
+      "http://root%5Buser%5D@[::1]/path_with_square_%5Bbrackets%5D?par=value%5B1%5D&par%5B2%5D=value%5B2%5D#fragment%5B2%5D",
+      "sqb in userinfo, host, path, request and fragment"
+    ) or show $u;
+
+  is( $u->scheme()                , "http",           "scheme");
+  is( $u->userinfo()              , "root%5Buser%5D", "userinfo");
+  is( $u->host()                  , "::1",            "host");
+  is( $u->ihost()                 , "::1",            "ihost");
+  is( $u->port()                  , "80",             "port");
+  is( $u->default_port()          , "80",             "default_port");
+  is( $u->host_port()             , "[::1]:80",       "host_port");
+  is( $u->secure()                , "0",              "is_secure" );
+  is( $u->path()                  , "/path_with_square_%5Bbrackets%5D", "path");
+  is( $u->opaque()                , "//root%5Buser%5D@[::1]/path_with_square_%5Bbrackets%5D?par=value%5B1%5D&par%5B2%5D=value%5B2%5D", "opaque");
+  is( $u->fragment()              , "fragment%5B2%5D", "fragment");
+  is( $u->query()                 , "par=value%5B1%5D&par%5B2%5D=value%5B2%5D", "query");
+  is( $u->as_string()             , "http://root%5Buser%5D@[::1]/path_with_square_%5Bbrackets%5D?par=value%5B1%5D&par%5B2%5D=value%5B2%5D#fragment%5B2%5D", "as_string");
+  is( $u->has_recognized_scheme() , "1", "has_recognized_scheme");
+  is( $u->as_iri()                , "http://root%5Buser%5D@[::1]/path_with_square_%5Bbrackets%5D?par=value%5B1%5D&par%5B2%5D=value%5B2%5D#fragment%5B2%5D", "as_iri"); #TODO: utf8
+
+  is( $u->abs( "/BASEDIR")->as_string() , "http://root%5Buser%5D@[::1]/path_with_square_%5Bbrackets%5D?par=value%5B1%5D&par%5B2%5D=value%5B2%5D#fragment%5B2%5D", "abs (no change)");
+  is( $u->rel("../BASEDIR")             , "http://root%5Buser%5D@[::1]/path_with_square_%5Bbrackets%5D?par=value%5B1%5D&par%5B2%5D=value%5B2%5D#fragment%5B2%5D", "rel");
+
+  is( $u->authority()                   , "root%5Buser%5D@[::1]", "authority" );
+  is( $u->path_query()                  , "/path_with_square_%5Bbrackets%5D?par=value%5B1%5D&par%5B2%5D=value%5B2%5D", "path_query");
+  is( $u->query_keywords()              , undef, "query_keywords");
+
+  my @segments = $u->path_segments();
+  is( join(" | ", @segments), " | path_with_square_[brackets]", "segments");
+}
+
+
+{ #-- form/query related tests
+  my $u = URI->new("http://root[user]@[::1]/path_with_square_[brackets]/segment[2]?par=value[1]&par[2]=value[2]#fragment[2]");
+
+  is( $u->query_form(), "4", "scalar: query_form");
+  is( join(" | ", $u->query_form()), "par | value[1] | par[2] | value[2]", "list: query_form");
+
+  $u->query_form( {} );
+  is( $u->query(), undef, "query removed");
+  is( join(" | ", $u->query_form()), "", "list: query_form");
+  is( $u->canonical(), "http://root%5Buser%5D@[::1]/path_with_square_%5Bbrackets%5D/segment%5B2%5D#fragment%5B2%5D", "query removed: canonical");
+
+  $u->query_form( key1 => 'val1', key2 => 'val[2]' );
+  is( $u->query(), "key1=val1&key2=val%5B2%5D", "query");
+}
+
+
+{ #-- path segments
+  my $u = URI->new("http://root[user]@[::1]/path_with_square_[brackets]/segment[2]?par=value[1]#fragment[2]");
+  my @segments = $u->path_segments();
+  is( join(" | ", @segments), " | path_with_square_[brackets] | segment[2]", "segments");
+}
+
+
+{ #-- rel
+  my $u = URI->new("http://root[user]@[::1]/oldbase/next/path_with_square_[brackets]/segment[2]?par=value[1]#fragment[2]");
+  #TODO: is userinfo@ optional?
+  is( $u->rel("http://root%5Buser%5D@[::1]/oldbase/next/")->canonical(),
+      "path_with_square_%5Bbrackets%5D/segment%5B2%5D?par=value%5B1%5D#fragment%5B2%5D",
+      "rel/canonical"
+    );
+}
+
+
+{ #-- various setters
+ my $ip6 = 'fedc:ba98:7654:3210:fedc:ba98:7654:3210';
+ my $u = URI->new("http://\[" . uc($ip6) . "\]/index.html");
+ is ($u->canonical(), "http://[$ip6]/index.html", "basic IPv6 URI");
+
+ $u->scheme("https");
+ is ($u->canonical(), "https://[$ip6]/index.html", "basic IPv6 URI");
+
+ $u->userinfo("user[42]"); #-- tolerate unescaped '[', ']'
+ is ($u->canonical(), "https://user%5B42%5D@[$ip6]/index.html", "userinfo added (unescaped)");
+ is ($u->userinfo(), "user%5B42%5D", "userinfo is escaped");
+
+ $u->userinfo("user%5B77%5D"); #-- already escaped
+ is ($u->canonical(), "https://user%5B77%5D@[$ip6]/index.html", "userinfo replaced (escaped)");
+ is ($u->userinfo(), "user%5B77%5D", "userinfo is escaped");
+
+ $u->userinfo( q(weird.al$!:secret*[1]++) );
+ is ($u->canonical(), "https://weird.al\$!:secret*%5B1%5D++@[$ip6]/index.html", "userinfo replaced (escaped2)");
+ is ($u->userinfo(),  "weird.al\$!:secret*%5B1%5D++", "userinfo is escaped2");
+
+ $u->userinfo( q(j.doe@example.com:secret) );
+ is ($u->canonical(), "https://j.doe%40example.com:secret@[$ip6]/index.html", "userinfo replaced (escaped3)");
+ is ($u->userinfo() , "j.doe%40example.com:secret", "userinfo is escaped3");
+
+ $u->host("example.com");
+ is ($u->canonical(), "https://j.doe%40example.com:secret\@example.com/index.html", "hostname replaced");
+
+ $u->host("127.0.0.1");
+ is ($u->canonical(), "https://j.doe%40example.com:secret\@127.0.0.1/index.html", "hostname replaced");
+
+ for my $host ( qw(example.com 127.0.0.1)) {
+   $u->host( $host );
+   my $expect = "https://j.doe%40example.com:secret\@$host/index.html";
+   is ($u->canonical(), $expect, "host: $host");
+   is ($u->host(), $host, "same hosts ($host)");
+ }
+
+ for my $host6 ( $ip6, qw(::1) ) {
+   $u->host( $host6 );
+   my $expect = "https://j.doe%40example.com:secret\@[$host6]/index.html";
+   is ($u->canonical(), $expect, "IPv6 host: $host6");
+   is ($u->host(), $host6, "same IPv6 hosts ($host6)");
+ }
+
+ $u->host($ip6);
+ $u->path("/subdir/index[1].html");
+ is( $u->canonical(), "https://j.doe%40example.com:secret@[$ip6]/subdir/index%5B1%5D.html", "path replaced");
+
+ $u->fragment("fragment[xyz]");
+ is( $u->canonical(), "https://j.doe%40example.com:secret@[$ip6]/subdir/index%5B1%5D.html#fragment%5Bxyz%5D", "fragment added");
+
+ $u->authority("user[doe]@[::1]");
+ is( $u->canonical(), "https://user%5Bdoe%5D@[::1]/subdir/index%5B1%5D.html#fragment%5Bxyz%5D", "authority replaced");
+
+ $u->authority("::1");
+ is( $u->canonical(), "https://[::1]/subdir/index%5B1%5D.html#fragment%5Bxyz%5D", "authority replaced");
+
+ $u->authority("[::1]:19999");
+ is( $u->canonical(), "https://[::1]:19999/subdir/index%5B1%5D.html#fragment%5Bxyz%5D", "authority replaced");
+
+ # $u->authority("::1:18000"); #-- theoretically, we could guess an [::1]:18000 ... but for now it will just be ill formatted.
+ # is( $u->canonical(), "https://::1:18000/subdir/index%5B1%5D.html#fragment%5Bxyz%5D", "authority replaced");
+
+ $u->authority("user[abc]\@::1");
+ is( $u->canonical(), "https://user%5Babc%5D@[::1]/subdir/index%5B1%5D.html#fragment%5Bxyz%5D", "authority replaced");
+
+ $u->authority("user[xyz]\@example.com\@[::1]:22022");
+ is( $u->canonical(), "https://user%5Bxyz%5D%40example.com@[::1]:22022/subdir/index%5B1%5D.html#fragment%5Bxyz%5D", "authority replaced");
+
+}
+
+done_testing;
index d56c7c5..20271e9 100644 (file)
@@ -4,7 +4,8 @@ use warnings;
 use Test::Needs 'Storable';
 print "1..3\n";
 
-system($^X, "-Iblib/lib", "t/storable-test.pl", "store");
-system($^X, "-Iblib/lib", "t/storable-test.pl", "retrieve");
+my $inc = -d "blib/lib" ? "blib/lib" : "lib";
+system($^X, "-I$inc", "t/storable-test.pl", "store");
+system($^X, "-I$inc", "t/storable-test.pl", "retrieve");
 
 unlink('urls.sto');
index ca30ef8..542723a 100755 (executable)
--- a/uri-test
+++ b/uri-test
@@ -14,6 +14,8 @@ my $orig = $uri;
 
 require URI;
 
+warn "Using: $INC{'URI.pm'}\n"  if  $INC{'URI.pm'} ne 'lib/URI.pm'  and  -t STDOUT  and  -t STDIN;
+
 my @ctor_arg = ($uri);
 push(@ctor_arg, shift) while @ARGV && $ARGV[0] =~ s/^\+//;
 
index a39f033..1b44dda 100644 (file)
@@ -64,6 +64,7 @@ Olaf
 OpenLDAP
 Parkhurst
 Perl
+Perlbotics
 Peter
 Piotr
 Punycode
@@ -145,6 +146,7 @@ nntp
 nntps
 oid
 olaf
+perlbotix
 piotr
 pop
 relativize
index a83040c..5235d01 100644 (file)
@@ -8,7 +8,7 @@ if (($ENV{TRAVIS_PULL_REQUEST} || '') eq 'false') {
 
 note 'Checking Changes';
 my $changes_file = 'Changes';
-my $newver = '5.10';
+my $newver = '5.12';
 my $trial_token = '-TRIAL';
 my $encoding = 'UTF-8';