summaryrefslogtreecommitdiff
path: root/cpan/HTTP-Tiny
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2011-10-27 22:45:21 +0100
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2011-10-27 23:38:17 +0100
commit6ce52845639625f8b650cc3295f1d620a8601df9 (patch)
treee832938f19eb3e445486bdbb362fe865f8925089 /cpan/HTTP-Tiny
parente4a351b76f9cb4fa0a965f0405bf1c37d9cffd3c (diff)
downloadperl-6ce52845639625f8b650cc3295f1d620a8601df9.tar.gz
Update HTTP-Tiny to CPAN version 0.016
[DELTA] 0.016 2011-10-26 23:05:50 America/New_York [BUG FIXES] - Fixed Perl 5.6 compatibility by emulating utf8::encode [David Golden]
Diffstat (limited to 'cpan/HTTP-Tiny')
-rw-r--r--cpan/HTTP-Tiny/lib/HTTP/Tiny.pm14
1 files changed, 11 insertions, 3 deletions
diff --git a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
index f0ed572451..c9a2dcaec2 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.015'; # VERSION
+our $VERSION = '0.016'; # VERSION
use Carp ();
@@ -355,13 +355,21 @@ sub _parse_http_date {
# URI escaping adapted from URI::Escape
# c.f. http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1
+# perl 5.6 ready UTF-8 encoding adapted from JSON::PP
my %escapes = map { chr($_) => sprintf("%%%02X", $_) } 0..255;
$escapes{' '}="+";
my $unsafe_char = qr/[^A-Za-z0-9\-\._~]/;
sub _uri_escape {
my ($self, $str) = @_;
- utf8::encode($str);
+ if ( $] ge '5.008' ) {
+ utf8::encode($str);
+ }
+ else {
+ $str = pack("U*", unpack("C*", $str)) # UTF-8 encode a byte string
+ if ( length $str == do { use bytes; length $str } );
+ $str = pack("C*", unpack("C*", $str)); # clear UTF-8 flag
+ }
$str =~ s/($unsafe_char)/$escapes{$1}/ge;
return $str;
}
@@ -832,7 +840,7 @@ HTTP::Tiny - A small, simple, correct HTTP/1.1 client
=head1 VERSION
-version 0.015
+version 0.016
=head1 SYNOPSIS