Commit 8cb0b32b authored by gregor herrmann's avatar gregor herrmann

Imported Upstream version 0.049

parents cbad410d 405c2215
Release notes for HTTP-Tiny
0.049 2014-09-02 11:20:07-04:00 America/New_York
[FIXED]
- 'keep_alive' is now fork-safe and thread-safe
0.048 2014-08-21 13:19:51-04:00 America/New_York
[FIXED]
- Protected proxy tests from ALL_PROXY in the environment
0.047 2014-07-29 14:09:05-04:00 America/New_York
[CHANGED]
......
......@@ -5,7 +5,7 @@
"David Golden <dagolden@cpan.org>"
],
"dynamic_config" : 0,
"generated_by" : "Dist::Zilla version 5.020, CPAN::Meta::Converter version 2.142060",
"generated_by" : "Dist::Zilla version 5.020, CPAN::Meta::Converter version 2.140640",
"license" : [
"perl_5"
],
......@@ -82,14 +82,11 @@
"ExtUtils::MakeMaker" : "0",
"File::Basename" : "0",
"File::Spec" : "0",
"File::Spec::Functions" : "0",
"File::Temp" : "0",
"IO::Dir" : "0",
"IO::File" : "0",
"IO::Socket::INET" : "0",
"IPC::Cmd" : "0",
"List::Util" : "0",
"Scalar::Util" : "0",
"Test::More" : "0.96",
"open" : "0"
}
......@@ -98,7 +95,7 @@
"provides" : {
"HTTP::Tiny" : {
"file" : "lib/HTTP/Tiny.pm",
"version" : "0.047"
"version" : "0.049"
}
},
"release_status" : "stable",
......@@ -113,7 +110,7 @@
"web" : "https://github.com/chansen/p5-http-tiny"
}
},
"version" : "0.047",
"version" : "0.049",
"x_authority" : "cpan:DAGOLDEN",
"x_contributors" : [
"Alan Gardner <gardner@pythian.com>",
......@@ -136,6 +133,7 @@
"Serguei Trouchelle <stro@cpan.org>",
"Syohei YOSHIDA <syohex@gmail.com>",
"Sören Kornetzki <soeren.kornetzki@delti.com>",
"Tom Hukins <tom@eborcom.com>",
"Tony Cook <tony@develop-help.com>"
]
}
......
......@@ -9,20 +9,17 @@ build_requires:
ExtUtils::MakeMaker: '0'
File::Basename: '0'
File::Spec: '0'
File::Spec::Functions: '0'
File::Temp: '0'
IO::Dir: '0'
IO::File: '0'
IO::Socket::INET: '0'
IPC::Cmd: '0'
List::Util: '0'
Scalar::Util: '0'
Test::More: '0.96'
open: '0'
configure_requires:
ExtUtils::MakeMaker: '6.17'
dynamic_config: 0
generated_by: 'Dist::Zilla version 5.020, CPAN::Meta::Converter version 2.142060'
generated_by: 'Dist::Zilla version 5.020, CPAN::Meta::Converter version 2.140640'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
......@@ -39,7 +36,7 @@ no_index:
provides:
HTTP::Tiny:
file: lib/HTTP/Tiny.pm
version: '0.047'
version: '0.049'
recommends:
HTTP::CookieJar: '0.001'
IO::Socket::IP: '0.25'
......@@ -60,7 +57,7 @@ resources:
bugtracker: https://github.com/chansen/p5-http-tiny/issues
homepage: https://github.com/chansen/p5-http-tiny
repository: https://github.com/chansen/p5-http-tiny.git
version: '0.047'
version: '0.049'
x_authority: cpan:DAGOLDEN
x_contributors:
- 'Alan Gardner <gardner@pythian.com>'
......@@ -83,4 +80,5 @@ x_contributors:
- 'Serguei Trouchelle <stro@cpan.org>'
- 'Syohei YOSHIDA <syohex@gmail.com>'
- 'Sören Kornetzki <soeren.kornetzki@delti.com>'
- 'Tom Hukins <tom@eborcom.com>'
- 'Tony Cook <tony@develop-help.com>'
......@@ -35,18 +35,15 @@ my %WriteMakefileArgs = (
"ExtUtils::MakeMaker" => 0,
"File::Basename" => 0,
"File::Spec" => 0,
"File::Spec::Functions" => 0,
"File::Temp" => 0,
"IO::Dir" => 0,
"IO::File" => 0,
"IO::Socket::INET" => 0,
"IPC::Cmd" => 0,
"List::Util" => 0,
"Scalar::Util" => 0,
"Test::More" => "0.96",
"open" => 0
},
"VERSION" => "0.047",
"VERSION" => "0.049",
"test" => {
"TESTS" => "t/*.t"
}
......@@ -61,16 +58,13 @@ my %FallbackPrereqs = (
"Fcntl" => 0,
"File::Basename" => 0,
"File::Spec" => 0,
"File::Spec::Functions" => 0,
"File::Temp" => 0,
"IO::Dir" => 0,
"IO::File" => 0,
"IO::Socket" => 0,
"IO::Socket::INET" => 0,
"IPC::Cmd" => 0,
"List::Util" => 0,
"MIME::Base64" => 0,
"Scalar::Util" => 0,
"Test::More" => "0.96",
"Time::Local" => 0,
"bytes" => 0,
......
......@@ -2,7 +2,7 @@ NAME
HTTP::Tiny - A small, simple, correct HTTP/1.1 client
VERSION
version 0.047
version 0.049
SYNOPSIS
use HTTP::Tiny;
......@@ -92,9 +92,10 @@ METHODS
The "keep_alive" parameter enables a persistent connection, but only to
a single destination scheme, host and port. Also, if any
connection-relevant attributes are modified, a persistent connection
will be dropped. If you want persistent connections across multiple
destinations, use multiple HTTP::Tiny objects.
connection-relevant attributes are modified, or if the process ID or
thread ID change, the persistent connection will be dropped. If you want
persistent connections across multiple destinations, use multiple
HTTP::Tiny objects.
See "SSL SUPPORT" for more on the "verify_SSL" and "SSL_options"
attributes.
......@@ -436,24 +437,6 @@ AUTHORS
CONTRIBUTORS
* Alan Gardner <gardner@pythian.com>
* Alessandro Ghedini <al3xbio@gmail.com>
* Brad Gilbert <bgills@cpan.org>
* Chris Nehren <apeiron@cpan.org>
* Chris Weyl <rsrchboy@cpan.org>
* Claes Jakobsson <claes@surfar.nu>
* Clinton Gormley <clint@traveljury.com>
* Craig Berry <cberry@cpan.org>
* David Mitchell <davem@iabyn.com>
* Edward Zborowski <ed@rubensteintech.com>
* James Raspass <jraspass@gmail.com>
* Jess Robinson <castaway@desert-island.me.uk>
......@@ -474,8 +457,28 @@ CONTRIBUTORS
* Sören Kornetzki <soeren.kornetzki@delti.com>
* Alessandro Ghedini <al3xbio@gmail.com>
* Tom Hukins <tom@eborcom.com>
* Tony Cook <tony@develop-help.com>
* Brad Gilbert <bgills@cpan.org>
* Chris Nehren <apeiron@cpan.org>
* Chris Weyl <rsrchboy@cpan.org>
* Claes Jakobsson <claes@surfar.nu>
* Clinton Gormley <clint@traveljury.com>
* Craig Berry <cberry@cpan.org>
* David Mitchell <davem@iabyn.com>
* Edward Zborowski <ed@rubensteintech.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Christian Hansen.
......
......@@ -20,14 +20,11 @@ on 'test' => sub {
requires "ExtUtils::MakeMaker" => "0";
requires "File::Basename" => "0";
requires "File::Spec" => "0";
requires "File::Spec::Functions" => "0";
requires "File::Temp" => "0";
requires "IO::Dir" => "0";
requires "IO::File" => "0";
requires "IO::Socket::INET" => "0";
requires "IPC::Cmd" => "0";
requires "List::Util" => "0";
requires "Scalar::Util" => "0";
requires "Test::More" => "0.96";
requires "open" => "0";
};
......
......@@ -17,6 +17,7 @@ remove = IO::Socket::IP
remove = IO::Socket::SSL
remove = Mozilla::CA
remove = Net::SSLeay
remove = threads
[Prereqs / Recommends]
HTTP::CookieJar = 0.001
......
......@@ -3,7 +3,7 @@ package HTTP::Tiny;
use strict;
use warnings;
# ABSTRACT: A small, simple, correct HTTP/1.1 client
our $VERSION = '0.047'; # VERSION
our $VERSION = '0.049'; # VERSION
use Carp ();
......@@ -53,9 +53,9 @@ use Carp ();
#pod
#pod The C<keep_alive> parameter enables a persistent connection, but only to a
#pod single destination scheme, host and port. Also, if any connection-relevant
#pod attributes are modified, a persistent connection will be dropped. If you want
#pod persistent connections across multiple destinations, use multiple HTTP::Tiny
#pod objects.
#pod attributes are modified, or if the process ID or thread ID change, the
#pod persistent connection will be dropped. If you want persistent connections
#pod across multiple destinations, use multiple HTTP::Tiny objects.
#pod
#pod See L</SSL SUPPORT> for more on the C<verify_SSL> and C<SSL_options> attributes.
#pod
......@@ -861,6 +861,15 @@ use warnings;
use Errno qw[EINTR EPIPE];
use IO::Socket qw[SOCK_STREAM];
# for thread safety, we need to know thread id or else fake it;
# requires "threads.pm" to hide it from the minimum version detector
if ( eval { require "threads.pm"; 1 } ) { ## no critic
*_get_tid = sub { threads->tid };
}
else {
*_get_tid = sub () { 0 };
}
# PERL_HTTP_TINY_IPV4_ONLY is a private environment variable to force old
# behavior if someone is unable to boostrap CPAN from a new perl install; it is
# not intended for general, per-client use and may be removed in the future
......@@ -924,6 +933,8 @@ sub connect {
$self->{scheme} = $scheme;
$self->{host} = $host;
$self->{port} = $port;
$self->{pid} = $$;
$self->{tid} = _get_tid();
return $self;
}
......@@ -1367,7 +1378,9 @@ sub _assert_ssl {
sub can_reuse {
my ($self,$scheme,$host,$port) = @_;
return 0 if
length($self->{rbuf})
$self->{pid} != $$
|| $self->{tid} != _get_tid()
|| length($self->{rbuf})
|| $scheme ne $self->{scheme}
|| $host ne $self->{host}
|| $port ne $self->{port}
......@@ -1444,7 +1457,7 @@ HTTP::Tiny - A small, simple, correct HTTP/1.1 client
=head1 VERSION
version 0.047
version 0.049
=head1 SYNOPSIS
......@@ -1554,9 +1567,9 @@ content field in the response will contain the text of the exception.
The C<keep_alive> parameter enables a persistent connection, but only to a
single destination scheme, host and port. Also, if any connection-relevant
attributes are modified, a persistent connection will be dropped. If you want
persistent connections across multiple destinations, use multiple HTTP::Tiny
objects.
attributes are modified, or if the process ID or thread ID change, the
persistent connection will be dropped. If you want persistent connections
across multiple destinations, use multiple HTTP::Tiny objects.
See L</SSL SUPPORT> for more on the C<verify_SSL> and C<SSL_options> attributes.
......@@ -2009,6 +2022,8 @@ David Golden <dagolden@cpan.org>
=head1 CONTRIBUTORS
=for stopwords Alan Gardner James Raspass Jess Robinson Lukas Eklund Martin J. Evans Martin-Louis Bright Mike Doherty Petr Písař Serguei Trouchelle Syohei YOSHIDA Sören Kornetzki Alessandro Ghedini Tom Hukins Tony Cook Brad Gilbert Chris Nehren Weyl Claes Jakobsson Clinton Gormley Craig Berry David Mitchell Edward Zborowski
=over 4
=item *
......@@ -2017,83 +2032,87 @@ Alan Gardner <gardner@pythian.com>
=item *
Alessandro Ghedini <al3xbio@gmail.com>
James Raspass <jraspass@gmail.com>
=item *
Brad Gilbert <bgills@cpan.org>
Jess Robinson <castaway@desert-island.me.uk>
=item *
Chris Nehren <apeiron@cpan.org>
Lukas Eklund <leklund@gmail.com>
=item *
Chris Weyl <rsrchboy@cpan.org>
Martin J. Evans <mjegh@ntlworld.com>
=item *
Claes Jakobsson <claes@surfar.nu>
Martin-Louis Bright <mlbright@gmail.com>
=item *
Clinton Gormley <clint@traveljury.com>
Mike Doherty <doherty@cpan.org>
=item *
Craig Berry <cberry@cpan.org>
Petr Písař <ppisar@redhat.com>
=item *
David Mitchell <davem@iabyn.com>
Serguei Trouchelle <stro@cpan.org>
=item *
Edward Zborowski <ed@rubensteintech.com>
Syohei YOSHIDA <syohex@gmail.com>
=item *
James Raspass <jraspass@gmail.com>
Sören Kornetzki <soeren.kornetzki@delti.com>
=item *
Jess Robinson <castaway@desert-island.me.uk>
Alessandro Ghedini <al3xbio@gmail.com>
=item *
Lukas Eklund <leklund@gmail.com>
Tom Hukins <tom@eborcom.com>
=item *
Martin J. Evans <mjegh@ntlworld.com>
Tony Cook <tony@develop-help.com>
=item *
Martin-Louis Bright <mlbright@gmail.com>
Brad Gilbert <bgills@cpan.org>
=item *
Mike Doherty <doherty@cpan.org>
Chris Nehren <apeiron@cpan.org>
=item *
Petr Písař <ppisar@redhat.com>
Chris Weyl <rsrchboy@cpan.org>
=item *
Serguei Trouchelle <stro@cpan.org>
Claes Jakobsson <claes@surfar.nu>
=item *
Syohei YOSHIDA <syohex@gmail.com>
Clinton Gormley <clint@traveljury.com>
=item *
Sören Kornetzki <soeren.kornetzki@delti.com>
Craig Berry <cberry@cpan.org>
=item *
Tony Cook <tony@develop-help.com>
David Mitchell <davem@iabyn.com>
=item *
Edward Zborowski <ed@rubensteintech.com>
=back
......
......@@ -55,14 +55,11 @@ do { my $x = {
'ExtUtils::MakeMaker' => '0',
'File::Basename' => '0',
'File::Spec' => '0',
'File::Spec::Functions' => '0',
'File::Temp' => '0',
'IO::Dir' => '0',
'IO::File' => '0',
'IO::Socket::INET' => '0',
'IPC::Cmd' => '0',
'List::Util' => '0',
'Scalar::Util' => '0',
'Test::More' => '0.96',
'open' => '0'
}
......
......@@ -3,14 +3,12 @@
use strict;
use warnings;
# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.016
# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.019
use Test::More tests => 1;
use ExtUtils::MakeMaker;
use File::Spec::Functions;
use List::Util qw/max first/;
use Scalar::Util qw/blessed/;
use File::Spec;
# from $version::LAX
my $lax_version_re =
......@@ -33,11 +31,17 @@ my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" &
# Verify requirements?
my $DO_VERIFY_PREREQS = 1;
sub _max {
my $max = shift;
$max = ( $_ > $max ) ? $_ : $max for @_;
return $max;
}
sub _merge_prereqs {
my ($collector, $prereqs) = @_;
# CPAN::Meta::Prereqs object
if (blessed $collector eq $cpan_meta_pre) {
if (ref $collector eq $cpan_meta_pre) {
return $collector->with_merged_prereqs(
CPAN::Meta::Prereqs->new( $prereqs )
);
......@@ -66,12 +70,6 @@ my @exclude = qw(
# Add static prereqs to the included modules list
my $static_prereqs = do 't/00-report-prereqs.dd';
### XXX: Assume these are Runtime Requires
my $static_prereqs_requires = $static_prereqs->{runtime}{requires};
for my $mod (@include) {
$static_prereqs_requires->{$mod} = 0 unless exists $static_prereqs_requires->{$mod};
}
# Merge all prereqs (either with ::Prereqs or a hashref)
my $full_prereqs = _merge_prereqs(
( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ),
......@@ -79,7 +77,7 @@ my $full_prereqs = _merge_prereqs(
);
# Add dynamic prereqs to the included modules list (if we can)
my $source = first { -f } 'MYMETA.json', 'MYMETA.yml';
my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml';
if ( $source && $HAS_CPAN_META ) {
if ( my $meta = eval { CPAN::Meta->load_file($source) } ) {
$full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs);
......@@ -93,11 +91,16 @@ my @full_reports;
my @dep_errors;
my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs;
for my $phase ( qw(configure build test runtime develop) ) {
# Add static includes into a fake section
for my $mod (@include) {
$req_hash->{other}{modules}{$mod} = 0;
}
for my $phase ( qw(configure build test runtime develop other) ) {
next unless $req_hash->{$phase};
next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING});
for my $type ( qw(requires recommends suggests conflicts) ) {
for my $type ( qw(requires recommends suggests conflicts modules) ) {
next unless $req_hash->{$phase}{$type};
my $title = ucfirst($phase).' '.ucfirst($type);
......@@ -105,12 +108,12 @@ for my $phase ( qw(configure build test runtime develop) ) {
for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) {
next if $mod eq 'perl';
next if first { $_ eq $mod } @exclude;
next if grep { $_ eq $mod } @exclude;
my $file = $mod;
$file =~ s{::}{/}g;
$file .= ".pm";
my $prefix = first { -e catfile($_, $file) } @INC;
my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC;
my $want = $req_hash->{$phase}{$type}{$mod};
$want = "undef" unless defined $want;
......@@ -119,7 +122,7 @@ for my $phase ( qw(configure build test runtime develop) ) {
my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required";
if ($prefix) {
my $have = MM->parse_version( catfile($prefix, $file) );
my $have = MM->parse_version( File::Spec->catfile($prefix, $file) );
$have = "undef" unless defined $have;
push @reports, [$mod, $want, $have];
......@@ -144,9 +147,9 @@ for my $phase ( qw(configure build test runtime develop) ) {
if ( @reports ) {
push @full_reports, "=== $title ===\n\n";
my $ml = max map { length $_->[0] } @reports;
my $wl = max map { length $_->[1] } @reports;
my $hl = max map { length $_->[2] } @reports;
my $ml = _max( map { length $_->[0] } @reports );
my $wl = _max( map { length $_->[1] } @reports );
my $hl = _max( map { length $_->[2] } @reports );
splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl];
push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports;
......
......@@ -10,6 +10,8 @@ use HTTP::Tiny;
# Require a true value
for my $proxy (undef, "", 0){
local $ENV{all_proxy} = undef;
local $ENV{ALL_PROXY} = undef;
local $ENV{http_proxy} = $proxy;
my $c = HTTP::Tiny->new();
ok(!defined $c->http_proxy);
......
......@@ -3,7 +3,7 @@
use strict;
use warnings;
use Test::More 0.88;
use Test::More 0.96;
use IO::Socket::INET;
BEGIN {
eval { require IO::Socket::SSL; IO::Socket::SSL->VERSION(1.56); 1 };
......
......@@ -156,6 +156,8 @@ sub sort_headers {
$self->{port} = $monkey_port = $port;
$self->{scheme} = $scheme;
$self->{fh} = shift @req_fh;
$self->{pid} = $$;
$self->{tid} = HTTP::Tiny::Handle::_get_tid();
return $self;
};
my $original_write_request = \&HTTP::Tiny::Handle::write_request;
......
......@@ -2,7 +2,7 @@ use 5.006;
use strict;
use warnings;
# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.043
# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.046
use Test::More tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
......@@ -48,6 +48,6 @@ for my $lib (@module_files)
is(scalar(@warnings), 0, 'no warnings found') if $ENV{AUTHOR_TESTING};
is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', explain \@warnings if $ENV{AUTHOR_TESTING};
......@@ -76,6 +76,9 @@ syohex
Sören
Kornetzki
soeren
Tom
Hukins
tom
Tony
Cook
tony
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment