This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update HTTP-Tiny to CPAN version 0.037
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Mon, 28 Oct 2013 22:36:42 +0000 (22:36 +0000)
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Mon, 28 Oct 2013 22:36:42 +0000 (22:36 +0000)
  [DELTA]

0.037     2013-10-28 13:26:21 America/New_York

    [FIXED]

    - Basic authentication in the URL is now unescaped before being encoded
      into the authentication header

    [DOCUMENTED]

    - Added HTTP::Tiny::UA to SEE ALSO and suggested it as the appropriate
      place for new features

MANIFEST
Porting/Maintainers.pl
cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
cpan/HTTP-Tiny/t/cases/auth-04.txt [new file with mode: 0644]

index da75c5f..33df1b3 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -1112,6 +1112,7 @@ cpan/HTTP-Tiny/t/BrokenCookieJar.pm
 cpan/HTTP-Tiny/t/cases/auth-01.txt
 cpan/HTTP-Tiny/t/cases/auth-02.txt
 cpan/HTTP-Tiny/t/cases/auth-03.txt
+cpan/HTTP-Tiny/t/cases/auth-04.txt
 cpan/HTTP-Tiny/t/cases/cookies-01.txt
 cpan/HTTP-Tiny/t/cases/cookies-02.txt
 cpan/HTTP-Tiny/t/cases/cookies-03.txt
index 859275c..19dc4f4 100755 (executable)
@@ -584,7 +584,7 @@ use File::Glob qw(:case);
     },
 
     'HTTP::Tiny' => {
-        'DISTRIBUTION' => 'DAGOLDEN/HTTP-Tiny-0.036.tar.gz',
+        'DISTRIBUTION' => 'DAGOLDEN/HTTP-Tiny-0.037.tar.gz',
         'FILES'        => q[cpan/HTTP-Tiny],
         'EXCLUDED'     => [
             't/00-compile.t',
index 6d0059c..b98e8be 100644 (file)
@@ -3,7 +3,7 @@ package HTTP::Tiny;
 use strict;
 use warnings;
 # ABSTRACT: A small, simple, correct HTTP/1.1 client
-our $VERSION = '0.036'; # VERSION
+our $VERSION = '0.037'; # VERSION
 
 use Carp ();
 
@@ -393,6 +393,8 @@ sub _split_url {
     $authority = (length($authority)) ? $authority : 'localhost';
     if ( $authority =~ /@/ ) {
         ($auth,$host) = $authority =~ m/\A([^@]*)@(.*)\z/;   # user:pass@host
+        # userinfo might be percent escaped, so recover real auth info
+        $auth =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
     }
     else {
         $host = $authority;
@@ -1000,7 +1002,7 @@ __END__
 
 =pod
 
-=encoding utf-8
+=encoding UTF-8
 
 =head1 NAME
 
@@ -1008,7 +1010,7 @@ HTTP::Tiny - A small, simple, correct HTTP/1.1 client
 
 =head1 VERSION
 
-version 0.036
+version 0.037
 
 =head1 SYNOPSIS
 
@@ -1189,6 +1191,11 @@ redirected request.) For example:
 
     $http->request('GET', 'http://Aladdin:open sesame@example.com/');
 
+If the "user:password" stanza contains reserved characters, they must
+be percent-escaped:
+
+    $http->request('GET', 'http://john%40example.com:password@example.com/');
+
 A hashref of options may be appended to modify the request.
 
 Valid options are:
@@ -1473,12 +1480,20 @@ There is no support for IPv6 of any kind.
 
 =back
 
+Despite the limitations listed above, HTTP::Tiny is considered nearly
+feature-complete.  If there are enhancements unrelated to the underlying
+transport, please consider them for L<HTTP::Tiny::UA> instead.
+
 =head1 SEE ALSO
 
 =over 4
 
 =item *
 
+L<HTTP::Tiny::UA> — Higher level UA features for HTTP::Tiny
+
+=item *
+
 L<HTTP::Thin> - HTTP::Tiny wrapper with L<HTTP::Request>/L<HTTP::Response> compatibility
 
 =item *
diff --git a/cpan/HTTP-Tiny/t/cases/auth-04.txt b/cpan/HTTP-Tiny/t/cases/auth-04.txt
new file mode 100644 (file)
index 0000000..2c832a0
--- /dev/null
@@ -0,0 +1,18 @@
+url
+  http://rjbs%40cpan.org:password@example.com/index.html
+expected
+  abcdefghijklmnopqrstuvwxyz1234567890abcdef
+----------
+GET /index.html HTTP/1.1
+Host: example.com
+Connection: close
+User-Agent: HTTP-Tiny/VERSION
+Authorization: Basic cmpic0BjcGFuLm9yZzpwYXNzd29yZA==
+
+----------
+HTTP/1.1 200 OK
+Date: Thu, 03 Feb 1994 00:00:00 GMT
+Content-Type: text/plain
+Content-Length: 42
+
+abcdefghijklmnopqrstuvwxyz1234567890abcdef