summaryrefslogtreecommitdiff
path: root/cpan/HTTP-Tiny
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2013-10-28 22:36:42 +0000
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2013-10-28 22:36:42 +0000
commitc010de1f1b69b5f07f06f13fa2ac1ec823efb1bc (patch)
tree8c4cf086477be650e994b333b6c6ca2a8cf154ad /cpan/HTTP-Tiny
parent38321b6f27e7e11ad92c1af843f39cf05c938082 (diff)
downloadperl-c010de1f1b69b5f07f06f13fa2ac1ec823efb1bc.tar.gz
Update HTTP-Tiny to CPAN version 0.037
[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
Diffstat (limited to 'cpan/HTTP-Tiny')
-rw-r--r--cpan/HTTP-Tiny/lib/HTTP/Tiny.pm21
-rw-r--r--cpan/HTTP-Tiny/t/cases/auth-04.txt18
2 files changed, 36 insertions, 3 deletions
diff --git a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
index 6d0059cbae..b98e8bea31 100644
--- a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
+++ b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
@@ -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
index 0000000000..2c832a0b58
--- /dev/null
+++ b/cpan/HTTP-Tiny/t/cases/auth-04.txt
@@ -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