summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2012-10-16 12:55:44 +0100
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2012-10-16 12:55:44 +0100
commit4e375cef4c9fb6974eb23e2ace1fb9ef0f42ce3f (patch)
tree1cd4a3a010ebbb2bc7900ed43c90a9549d193da2
parentf01d5fbb7c762a511059bf4d6fe9ac889d1bde53 (diff)
downloadperl-4e375cef4c9fb6974eb23e2ace1fb9ef0f42ce3f.tar.gz
Update HTTP-Tiny to CPAN version 0.024
[DELTA] 0.024 2012-10-09 20:44:53 America/New_York [ADDED] - SSL connections now auto-retry I/O after SSL renegotiation [Alan Gardner] [FIXED] - User-specified CA bundles take precedence over Mozilla::CA [Alan Gardner] [PREREQS] - SSL support now requires Net::SSLeay 1.49 or greater to support auto-retry [Mike Doherty] - Downgraded IO::Socket::SSL and related prereqs to 'suggests' again 0.023 2012-09-19 09:55:46 America/New_York [PREREQS] - IO::Socket::SSL and related prereqs changed to 'required' for dev release to get better failure diagnostics from CPAN Testers [TESTING] - Skip live SSL testing unless IO::Socket::SSL 1.56+ installed
-rwxr-xr-xPorting/Maintainers.pl4
-rw-r--r--cpan/HTTP-Tiny/lib/HTTP/Tiny.pm69
2 files changed, 55 insertions, 18 deletions
diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index 61c699455b..3ddf5979a0 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -106,7 +106,7 @@ use File::Glob qw(:case);
GOALS HISTORY INSTALL INSTALL.SKIP LICENSE Makefile.PL
MANIFEST MANIFEST.SKIP META.yml MYMETA.yml META.json MYMETA.json
NEW NOTES perlcritic.rc ppport.h README README.PATCHING SIGNATURE
- THANKS TODO Todo VERSION WHATSNEW
+ THANKS TODO Todo VERSION WHATSNEW CONTRIBUTING
);
# Each entry in the %Modules hash roughly represents a distribution,
@@ -971,7 +971,7 @@ use File::Glob qw(:case);
'HTTP::Tiny' => {
'MAINTAINER' => 'dagolden',
- 'DISTRIBUTION' => 'DAGOLDEN/HTTP-Tiny-0.022.tar.gz',
+ 'DISTRIBUTION' => 'DAGOLDEN/HTTP-Tiny-0.024.tar.gz',
'FILES' => q[cpan/HTTP-Tiny],
'EXCLUDED' => [
't/00-report-prereqs.t',
diff --git a/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm b/cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
index 01f4e92e99..463a6c3226 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.022'; # VERSION
+our $VERSION = '0.024'; # VERSION
use Carp ();
@@ -423,6 +423,8 @@ sub connect {
if ( $scheme eq 'https' ) {
die(qq/IO::Socket::SSL 1.56 must be installed for https support\n/)
unless eval {require IO::Socket::SSL; IO::Socket::SSL->VERSION(1.56)};
+ die(qq/Net::SSLeay 1.49 must be installed for https support\n/)
+ unless eval {require Net::SSLeay; Net::SSLeay->VERSION(1.49)};
}
elsif ( $scheme ne 'http' ) {
die(qq/Unsupported URL scheme '$scheme'\n/);
@@ -430,7 +432,7 @@ sub connect {
$self->{fh} = 'IO::Socket::INET'->new(
PeerHost => $host,
PeerPort => $port,
- $self->{local_address} ?
+ $self->{local_address} ?
( LocalAddr => $self->{local_address} ) : (),
Proto => 'tcp',
Type => SOCK_STREAM,
@@ -442,7 +444,15 @@ sub connect {
if ( $scheme eq 'https') {
my $ssl_args = $self->_ssl_args($host);
- IO::Socket::SSL->start_SSL($self->{fh}, %$ssl_args);
+ IO::Socket::SSL->start_SSL(
+ $self->{fh},
+ %$ssl_args,
+ SSL_create_ctx_callback => sub {
+ my $ctx = shift;
+ Net::SSLeay::CTX_set_mode($ctx, Net::SSLeay::MODE_AUTO_RETRY());
+ },
+ );
+
unless ( ref($self->{fh}) eq 'IO::Socket::SSL' ) {
my $ssl_err = IO::Socket::SSL->errstr;
die(qq/SSL connection failed for $host: $ssl_err\n/);
@@ -489,7 +499,14 @@ sub write {
die(qq/Socket closed by remote server: $!\n/);
}
elsif ($! != EINTR) {
- die(qq/Could not write to socket: '$!'\n/);
+ if ($self->{fh}->can('errstr')){
+ my $err = $self->{fh}->errstr();
+ die (qq/Could not write to SSL socket: '$err'\n /);
+ }
+ else {
+ die(qq/Could not write to socket: '$!'\n/);
+ }
+
}
}
return $off;
@@ -517,7 +534,13 @@ sub read {
$len -= $r;
}
elsif ($! != EINTR) {
- die(qq/Could not read from socket: '$!'\n/);
+ if ($self->{fh}->can('errstr')){
+ my $err = $self->{fh}->errstr();
+ die (qq/Could not read from SSL socket: '$err'\n /);
+ }
+ else {
+ die(qq/Could not read from socket: '$!'\n/);
+ }
}
}
if ($len && !$allow_partial) {
@@ -544,7 +567,13 @@ sub readline {
last unless $r;
}
elsif ($! != EINTR) {
- die(qq/Could not read from socket: '$!'\n/);
+ if ($self->{fh}->can('errstr')){
+ my $err = $self->{fh}->errstr();
+ die (qq/Could not read from SSL socket: '$err'\n /);
+ }
+ else {
+ die(qq/Could not read from socket: '$!'\n/);
+ }
}
}
die(qq/Unexpected end of stream while looking for line\n/);
@@ -834,6 +863,11 @@ sub can_write {
# Try to find a CA bundle to validate the SSL cert,
# prefer Mozilla::CA or fallback to a system file
sub _find_CA_file {
+ my $self = shift();
+
+ return $self->{SSL_options}->{SSL_ca_file}
+ if $self->{SSL_options}->{SSL_ca_file} and -e $self->{SSL_options}->{SSL_ca_file};
+
return Mozilla::CA::SSL_ca_file()
if eval { require Mozilla::CA };
@@ -878,9 +912,8 @@ sub _ssl_args {
1;
-
-
__END__
+
=pod
=head1 NAME
@@ -889,7 +922,7 @@ HTTP::Tiny - A small, simple, correct HTTP/1.1 client
=head1 VERSION
-version 0.022
+version 0.024
=head1 SYNOPSIS
@@ -1174,9 +1207,10 @@ SSL_options
=head1 SSL SUPPORT
Direct C<https> connections are supported only if L<IO::Socket::SSL> 1.56 or
-greater is installed. An exception will be thrown if a new enough
-IO::Socket::SSL is not installed or if the SSL encryption fails. There is no
-support for C<https> connections via proxy (i.e. RFC 2817).
+greater and L<Net::SSLeay> 1.49 or greater are installed. An exception will be
+thrown if a new enough versions of these modules not installed or if the SSL
+encryption fails. There is no support for C<https> connections via proxy (i.e.
+RFC 2817).
SSL provides two distinct capabilities:
@@ -1336,6 +1370,10 @@ L<IO::Socket::SSL>
L<Mozilla::CA>
+=item *
+
+L<Net::SSLeay>
+
=back
=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
@@ -1345,7 +1383,7 @@ L<Mozilla::CA>
=head2 Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker
-at L<http://rt.cpan.org/Public/Dist/Display.html?Name=HTTP-Tiny>.
+at L<https://rt.cpan.org/Public/Dist/Display.html?Name=HTTP-Tiny>.
You will be notified automatically of any progress on your issue.
=head2 Source Code
@@ -1353,9 +1391,9 @@ You will be notified automatically of any progress on your issue.
This is open source software. The code repository is available for
public review and contribution under the terms of the license.
-L<https://github.com/dagolden/p5-http-tiny>
+L<https://github.com/dagolden/http-tiny>
- git clone https://github.com/dagolden/p5-http-tiny.git
+ git clone git://github.com/dagolden/http-tiny.git
=head1 AUTHORS
@@ -1383,4 +1421,3 @@ This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
-