cpan/HTTP-Tiny/corpus/redirect-08.txt
cpan/HTTP-Tiny/corpus/redirect-09.txt
cpan/HTTP-Tiny/corpus/redirect-10.txt
-cpan/HTTP-Tiny/corpus/snake-oil.crt
cpan/HTTP-Tiny/lib/HTTP/Tiny.pm
-cpan/HTTP-Tiny/t/00-report-prereqs.dd
-cpan/HTTP-Tiny/t/00-report-prereqs.t
cpan/HTTP-Tiny/t/000_load.t
cpan/HTTP-Tiny/t/001_api.t
cpan/HTTP-Tiny/t/002_croakage.t
cpan/HTTP-Tiny/t/162_proxy_auth.t
cpan/HTTP-Tiny/t/170_keepalive.t
cpan/HTTP-Tiny/t/180_verify_SSL.t
-cpan/HTTP-Tiny/t/200_live.t
-cpan/HTTP-Tiny/t/200_live_local_ip.t
-cpan/HTTP-Tiny/t/210_live_ssl.t
cpan/HTTP-Tiny/t/BrokenCookieJar.pm
cpan/HTTP-Tiny/t/SimpleCookieJar.pm
cpan/HTTP-Tiny/t/Util.pm
'DISTRIBUTION' => 'DAGOLDEN/HTTP-Tiny-0.082.tar.gz',
'FILES' => q[cpan/HTTP-Tiny],
'EXCLUDED' => [
+ 'corpus/snake-oil.crt', # only used by 210_live_ssl.t
't/00-report-prereqs.t',
't/00-report-prereqs.dd',
't/200_live.t',
+++ /dev/null
-Generated with:
-
- openssl req -new -newkey rsa:4096 -x509 -new -nodes -sha256 -days 7300 -keyout /dev/null -out snake-oil.crt -subj '/CN=snake.oil/'
-
------BEGIN CERTIFICATE-----
-MIIFCTCCAvGgAwIBAgIUUUWe96AgoaW3pyYxlJfMxUMA6bgwDQYJKoZIhvcNAQEL
-BQAwFDESMBAGA1UEAwwJc25ha2Uub2lsMB4XDTIzMDUyMTE1NDkxMVoXDTQzMDUx
-NjE1NDkxMVowFDESMBAGA1UEAwwJc25ha2Uub2lsMIICIjANBgkqhkiG9w0BAQEF
-AAOCAg8AMIICCgKCAgEAnScXg4MGa6CmCFOYzr8ggzqsDAR0CoVdOaqQ6XtRoRcP
-PzptoqHD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R2XZTLbpKxNfk426hTjJBkRULT5
-s7IWuuEO4Bb1p27K2WgHGh0mxFk4POPFmotxupVqzl8g2umcfWLDq0UR3BcRyR3B
-GWZNCcDTVLaAsarbSJoY1L/6j4O0RQdgpOWiENLbEcelGprGLBVe4s/NDA6aUYA+
-2Dll+0tHe6oKI+RCRoDhhiAH7UVIGQdORzcbY3Fxbf1OlFdpOyXLI751b1DjSYRu
-9cVFXZIBRTTiEvGbUfoDEXDmKxpWHkGRel2864FBodcwGv7yW6mC3o6vpOqQFcW7
-MjJsFhtVj8PdPmue+ye766PeH45ydDD01nr1I92w6E1C0pEEqRNEpoOGgORyNgit
-EZag4DlWFs5MFdlj32haztRgi2dhVuJxlzx4lAmvOoqvGVQVIicN1JSlikBk
------END CERTIFICATE-----
+++ /dev/null
-do { my $x = {
- 'configure' => {
- 'requires' => {
- 'ExtUtils::MakeMaker' => '6.17',
- 'perl' => '5.006'
- },
- 'suggests' => {
- 'JSON::PP' => '2.27300'
- }
- },
- 'develop' => {
- 'requires' => {
- 'Dist::Zilla' => '5',
- 'Dist::Zilla::Plugin::Prereqs' => '0',
- 'Dist::Zilla::Plugin::ReleaseStatus::FromVersion' => '0',
- 'Dist::Zilla::Plugin::RemovePrereqs' => '0',
- 'Dist::Zilla::PluginBundle::DAGOLDEN' => '0.072',
- 'File::Spec' => '0',
- 'File::Temp' => '0',
- 'IO::Handle' => '0',
- 'IPC::Open3' => '0',
- 'Perl::Critic::Policy::Lax::ProhibitStringyEval::ExceptForRequire' => '0',
- 'Pod::Coverage::TrustPod' => '0',
- 'Pod::Wordlist' => '0',
- 'Software::License::Perl_5' => '0',
- 'Test::CPAN::Meta' => '0',
- 'Test::MinimumVersion' => '0',
- 'Test::More' => '0',
- 'Test::Perl::Critic' => '0',
- 'Test::Pod' => '1.41',
- 'Test::Pod::Coverage' => '1.08',
- 'Test::Portability::Files' => '0',
- 'Test::Spelling' => '0.12',
- 'Test::Version' => '1',
- 'perl' => '5.006'
- }
- },
- 'runtime' => {
- 'recommends' => {
- 'HTTP::CookieJar' => '0.001',
- 'IO::Socket::IP' => '0.32',
- 'IO::Socket::SSL' => '1.42',
- 'Mozilla::CA' => '20160104',
- 'Net::SSLeay' => '1.49'
- },
- 'requires' => {
- 'Carp' => '0',
- 'Fcntl' => '0',
- 'IO::Socket' => '0',
- 'MIME::Base64' => '0',
- 'Socket' => '0',
- 'Time::Local' => '0',
- 'bytes' => '0',
- 'perl' => '5.006',
- 'strict' => '0',
- 'warnings' => '0'
- },
- 'suggests' => {
- 'IO::Socket::SSL' => '1.56'
- }
- },
- 'test' => {
- 'recommends' => {
- 'CPAN::Meta' => '2.120900'
- },
- 'requires' => {
- 'Data::Dumper' => '0',
- 'Exporter' => '0',
- 'ExtUtils::MakeMaker' => '0',
- 'File::Basename' => '0',
- 'File::Spec' => '0',
- 'File::Temp' => '0',
- 'IO::Dir' => '0',
- 'IO::File' => '0',
- 'IO::Socket::INET' => '0',
- 'IPC::Cmd' => '0',
- 'Test::More' => '0.96',
- 'lib' => '0',
- 'open' => '0',
- 'perl' => '5.006'
- }
- }
- };
- $x;
- }
\ No newline at end of file
+++ /dev/null
-#!perl
-
-use strict;
-use warnings;
-
-# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.029
-
-use Test::More tests => 1;
-
-use ExtUtils::MakeMaker;
-use File::Spec;
-
-# from $version::LAX
-my $lax_version_re =
- qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )?
- |
- (?:\.[0-9]+) (?:_[0-9]+)?
- ) | (?:
- v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )?
- |
- (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)?
- )
- )/x;
-
-# hide optional CPAN::Meta modules from prereq scanner
-# and check if they are available
-my $cpan_meta = "CPAN::Meta";
-my $cpan_meta_pre = "CPAN::Meta::Prereqs";
-my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic
-
-# 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 (ref $collector eq $cpan_meta_pre) {
- return $collector->with_merged_prereqs(
- CPAN::Meta::Prereqs->new( $prereqs )
- );
- }
-
- # Raw hashrefs
- for my $phase ( keys %$prereqs ) {
- for my $type ( keys %{ $prereqs->{$phase} } ) {
- for my $module ( keys %{ $prereqs->{$phase}{$type} } ) {
- $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module};
- }
- }
- }
-
- return $collector;
-}
-
-my @include = qw(
-
-);
-
-my @exclude = qw(
-
-);
-
-# Add static prereqs to the included modules list
-my $static_prereqs = do './t/00-report-prereqs.dd';
-
-# Merge all prereqs (either with ::Prereqs or a hashref)
-my $full_prereqs = _merge_prereqs(
- ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ),
- $static_prereqs
-);
-
-# Add dynamic prereqs to the included modules list (if we can)
-my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml';
-my $cpan_meta_error;
-if ( $source && $HAS_CPAN_META
- && (my $meta = eval { CPAN::Meta->load_file($source) } )
-) {
- $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs);
-}
-else {
- $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source)
- $source = 'static metadata';
-}
-
-my @full_reports;
-my @dep_errors;
-my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs;
-
-# 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 modules) ) {
- next unless $req_hash->{$phase}{$type};
-
- my $title = ucfirst($phase).' '.ucfirst($type);
- my @reports = [qw/Module Want Have/];
-
- for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) {
- next if grep { $_ eq $mod } @exclude;
-
- my $want = $req_hash->{$phase}{$type}{$mod};
- $want = "undef" unless defined $want;
- $want = "any" if !$want && $want == 0;
-
- if ($mod eq 'perl') {
- push @reports, ['perl', $want, $]];
- next;
- }
-
- my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required";
-
- my $file = $mod;
- $file =~ s{::}{/}g;
- $file .= ".pm";
- my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC;
-
- if ($prefix) {
- my $have = MM->parse_version( File::Spec->catfile($prefix, $file) );
- $have = "undef" unless defined $have;
- push @reports, [$mod, $want, $have];
-
- if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) {
- if ( $have !~ /\A$lax_version_re\z/ ) {
- push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)";
- }
- elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) {
- push @dep_errors, "$mod version '$have' is not in required range '$want'";
- }
- }
- }
- else {
- push @reports, [$mod, $want, "missing"];
-
- if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) {
- push @dep_errors, "$mod is not installed ($req_string)";
- }
- }
- }
-
- 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 );
-
- if ($type eq 'modules') {
- splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl];
- push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports;
- }
- else {
- 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;
- }
-
- push @full_reports, "\n";
- }
- }
-}
-
-if ( @full_reports ) {
- diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports;
-}
-
-if ( $cpan_meta_error || @dep_errors ) {
- diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n";
-}
-
-if ( $cpan_meta_error ) {
- my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml';
- diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n";
-}
-
-if ( @dep_errors ) {
- diag join("\n",
- "\nThe following REQUIRED prerequisites were not satisfied:\n",
- @dep_errors,
- "\n"
- );
-}
-
-pass('Reported prereqs');
-
-# vim: ts=4 sts=4 sw=4 et:
+++ /dev/null
-#!perl
-
-use strict;
-use warnings;
-
-use IO::Socket::INET;
-use Test::More 0.88;
-use HTTP::Tiny;
-
-my $test_host = "google.com";
-my $test_url = "http://www.google.com/";
-my $test_re = qr/google/;
-
-plan 'skip_all' => "Only run for \$ENV{AUTOMATED_TESTING}"
- unless $ENV{AUTOMATED_TESTING};
-
-plan 'skip_all' => "Internet connection timed out"
- unless IO::Socket::INET->new(
- PeerHost => $test_host,
- PeerPort => 80,
- Proto => 'tcp',
- Timeout => 10,
- );
-
-my $ua = HTTP::Tiny->new;
-my $response = $ua->get($test_url);
-if ( $ua->{handle} ) {
- my $socket_class = ref $ua->{handle}{fh};
- diag "HTTP::Tiny using $socket_class version " . $socket_class->VERSION;
-}
-
-ok( $response->{status} ne '599', "Request to $test_url completed" )
- or dump_hash($response);
-ok( $response->{content}, "Got content" );
-
-sub dump_hash {
- my $hash = shift;
- $hash->{content} = substr($hash->{content},0,160) . "...";
- require Data::Dumper;
- my $dumped = Data::Dumper::Dumper($hash);
- $dumped =~ s{^}{# };
- print $dumped;
-}
-
-done_testing;
+++ /dev/null
-#!perl
-
-use strict;
-use warnings;
-
-use IO::Socket::INET;
-use Test::More 0.88;
-use HTTP::Tiny;
-
-my $test_host = "www.google.com";
-my $test_url = "http://www.google.com/";
-
-plan 'skip_all' => "Only run for \$ENV{AUTOMATED_TESTING}"
- unless $ENV{AUTOMATED_TESTING};
-
-plan 'skip_all' => "Internet connection timed out"
- unless IO::Socket::INET->new(
- PeerHost => $test_host,
- PeerPort => 80,
- Proto => 'tcp',
- Timeout => 10,
- );
-
-my ($tiny, $response);
-
-# default local address should work; try three times since the test url
-# can have intermittent failures
-$tiny = HTTP::Tiny->new;
-for (1 .. 3) {
- $response = $tiny->get($test_url);
- last if $response->{success};
- sleep 2;
-}
-isnt( $response->{status}, '599', "Request to $test_url completed (default local address)" );
-
-# bad local IP should fail
-$tiny = HTTP::Tiny->new(local_address => '999.999.999.999'); # bad IP is error
-$response = $tiny->get($test_url);
-is( $response->{status}, '599', "Request to $test_url failed (invalid local address)" )
- or diag explain $response;
-
-done_testing;
+++ /dev/null
-#!perl
-
-use strict;
-use warnings;
-
-use Test::More 0.96;
-use IO::Socket::INET;
-BEGIN {
- eval { require IO::Socket::SSL; IO::Socket::SSL->VERSION(1.56); 1 };
- plan skip_all => 'IO::Socket::SSL 1.56 required for SSL tests' if $@;
- # $IO::Socket::SSL::DEBUG = 3;
-
- eval { require Net::SSLeay; Net::SSLeay->VERSION(1.49); 1};
- plan skip_all => 'Net::SSLeay 1.49 required for SSL tests' if $@;
-
- eval { require Mozilla::CA; 1 };
- plan skip_all => 'Mozilla::CA required for SSL tests' if $@;
-}
-use HTTP::Tiny;
-
-delete $ENV{PERL_HTTP_TINY_INSECURE_BY_DEFAULT};
-
-plan skip_all => 'Only run for $ENV{AUTOMATED_TESTING}'
- unless $ENV{AUTOMATED_TESTING};
-
-use IPC::Cmd qw/can_run/;
-
-if ( can_run('openssl') ) {
- diag "\nNote: running test with ", qx/openssl version/;
-}
-
-test_ssl('https://cpan.org/' => {
- host => 'cpan.org',
- pass => { verify_SSL => 1 },
- fail => { verify_SSL => 1, SSL_options => { SSL_ca_file => "corpus/snake-oil.crt" } },
- default_verify_should_return => !!1,
-});
-
-test_ssl('https://github.com/' => {
- host => 'github.com',
- pass => { verify_SSL => 1 },
- fail => { verify_SSL => 1, SSL_options => { SSL_ca_file => "corpus/snake-oil.crt" } },
- default_verify_should_return => !!1,
-});
-
-test_ssl('https://wrong.host.badssl.com/' => {
- host => 'wrong.host.badssl.com',
- pass => { SSL_options => { SSL_verifycn_scheme => 'none', SSL_verifycn_name => 'wrong.host.badssl.com', SSL_verify_mode => 0x00 } },
- fail => { SSL_options => { SSL_verifycn_scheme => 'http', SSL_verifycn_name => 'wrong.host.badssl.com', SSL_verify_mode => 0x01, SSL_ca_file => Mozilla::CA::SSL_ca_file() } },
- default_verify_should_return => !!0,
-});
-
-test_ssl('https://untrusted-root.badssl.com/' => {
- host => 'untrusted-root.badssl.com',
- pass => { verify_SSL => 0 },
- fail => { verify_SSL => 1 },
- default_verify_should_return => !!0,
-});
-
-test_ssl('https://mozilla-modern.badssl.com/' => {
- host => 'mozilla-modern.badssl.com',
- pass => { verify_SSL => 1 },
- fail => { verify_SSL => 1, SSL_options => { SSL_ca_file => "corpus/snake-oil.crt" } },
- default_verify_should_return => !!1,
-});
-
-{
- local $ENV{PERL_HTTP_TINY_INSECURE_BY_DEFAULT} = 1;
- test_ssl('https://wrong.host.badssl.com/' => {
- host => 'wrong.host.badssl.com',
- pass => { verify_SSL => 0 },
- fail => { verify_SSL => 1 },
- default_verify_should_return => !!1,
- });
- test_ssl('https://expired.badssl.com/' => {
- host => 'expired.badssl.com',
- pass => { verify_SSL => 0 },
- fail => { verify_SSL => 1 },
- default_verify_should_return => !!1,
- });
-
-}
-
-test_ssl('https://wrong.host.badssl.com/' => {
- host => 'wrong.host.badssl.com',
- pass => { verify_SSL => 0 },
- fail => { verify_SSL => 1 },
- default_verify_should_return => !!0,
-});
-
-test_ssl('https://expired.badssl.com/' => {
- host => 'expired.badssl.com',
- pass => { verify_SSL => 0 },
- fail => { verify_SSL => 1 },
- default_verify_should_return => !!0,
-});
-
-
-
-subtest "can_ssl" => sub {
- ok( HTTP::Tiny->can_ssl, "class method" );
- ok( HTTP::Tiny->new->can_ssl, "object method, default params" );
- ok( HTTP::Tiny->new(verify_SSL => 1)->can_ssl, "object method, verify_SSL" );
-
- my $ht = HTTP::Tiny->new(
- verify_SSL => 1,
- SSL_options => { SSL_ca_file => 'adlfadkfadlfad' },
- );
- my ($ok, $why) = $ht->can_ssl;
- ok( ! $ok, "object methods, verify_SSL, bogus CA file (FAILS)" );
- like( $why, qr/not found or not readable/, "failure reason" );
-};
-
-done_testing();
-
-sub test_ssl {
- my ($url, $data) = @_;
- subtest $url => sub {
- plan 'skip_all' => 'Internet connection timed out'
- unless IO::Socket::INET->new(
- PeerHost => $data->{host},
- PeerPort => 443,
- Proto => 'tcp',
- Timeout => 10,
- );
-
- # the default verification
- my $response = HTTP::Tiny->new()->get($url);
- is $response->{success}, $data->{default_verify_should_return}, "Request to $url passed/failed using default as expected"
- or do {
- # $response->{content} = substr $response->{content}, 0, 50;
- $response->{content} =~ s{\n.*}{}s;
- diag explain [IO::Socket::SSL::errstr(), $response]
- };
-
- # force validation to succeed
- if ($data->{pass}) {
- my $pass = HTTP::Tiny->new( %{$data->{pass}} )->get($url);
- isnt $pass->{status}, '599', "Request to $url completed (forced pass)"
- or do {
- $pass->{content} =~ s{\n.*}{}s;
- diag explain $pass
- };
- ok $pass->{content}, 'Got some content';
- }
-
- # force validation to fail
- if ($data->{fail}) {
- my $fail = HTTP::Tiny->new( %{$data->{fail}} )->get($url);
- is $fail->{status}, '599', "Request to $url failed (forced fail)"
- or do {
- $fail->{content} =~ s{\n.*}{}s;
- diag explain [IO::Socket::SSL::errstr(), $fail]
- };
- ok $fail->{content}, 'Got some content';
- }
- };
-}