diff options
Diffstat (limited to 'cpan/HTTP-Tiny')
-rw-r--r-- | cpan/HTTP-Tiny/lib/HTTP/Tiny.pm | 21 | ||||
-rw-r--r-- | cpan/HTTP-Tiny/t/cases/auth-04.txt | 18 |
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 |