From fceb2d419996e35f394d758d9b090e520cf7a218 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sat, 11 Apr 2015 12:00:17 +0300 Subject: [PATCH] Use HTTPS and include diagnostics in test --- Makefile.PL | 2 ++ lib/WebService/Strike.pm | 6 +++--- lib/WebService/Strike/Torrent.pm | 2 +- t/WebService-Strike.t | 10 ++++++++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index a3d233e..715e488 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -16,7 +16,9 @@ WriteMakefile( PREREQ_PM => { qw/Class::Accessor::Fast 0 Date::Parse 0 + IO::Socket::SSL 0 JSON::MaybeXS 0 + Mozilla::CA 0 Sort::ByExample 0/, }, META_ADD => { diff --git a/lib/WebService/Strike.pm b/lib/WebService/Strike.pm index bf51deb..74a8c2b 100644 --- a/lib/WebService/Strike.pm +++ b/lib/WebService/Strike.pm @@ -8,14 +8,14 @@ use parent qw/Exporter/; our @EXPORT = qw/strike strike_search/; ## no critic (ProhibitAutomaticExportation) our @EXPORT_OK = qw/strike_query strike strike_search/; our $VERSION = '0.003'; -our $BASE_URL = 'http://getstrike.net/api/v2/torrents'; +our $BASE_URL = 'https://getstrike.net/api/v2/torrents'; use JSON::MaybeXS qw/decode_json/; use HTTP::Tiny; use Sort::ByExample qw/sbe/; use WebService::Strike::Torrent; -sub _ht { HTTP::Tiny->new(agent => "WebService-Strike/$VERSION") } +sub _ht { HTTP::Tiny->new(agent => "WebService-Strike/$VERSION", verify_SSL => 1) } sub _query { my ($url) = @_; @@ -118,7 +118,7 @@ For example: =head1 SEE ALSO -L, L, L +L, L, L =head1 AUTHOR diff --git a/lib/WebService/Strike/Torrent.pm b/lib/WebService/Strike/Torrent.pm index 89ed206..4268d79 100644 --- a/lib/WebService/Strike/Torrent.pm +++ b/lib/WebService/Strike/Torrent.pm @@ -157,7 +157,7 @@ Both forms return a true value for success and false for failure. =head1 SEE ALSO -L, L +L, L =head1 AUTHOR diff --git a/t/WebService-Strike.t b/t/WebService-Strike.t index 42825e1..7713555 100644 --- a/t/WebService-Strike.t +++ b/t/WebService-Strike.t @@ -2,12 +2,18 @@ use strict; use warnings; -use Test::RequiresInternet qw/getstrike.net 80/; +use Data::Dumper qw/Dumper/; +use Test::RequiresInternet qw/getstrike.net 443/; use Test::More tests => 9; use Try::Tiny; BEGIN { use_ok('WebService::Strike') }; -my ($t1, $t2, $t3) = strike qw/B425907E5755031BDA4A8D1B6DCCACA97DA14C04 5D4FD5A64E436A831383773F85FB38B888B9ECC9 85DF191A921C20B2DDAFF72368CAB93BA18C5ACE/; +my ($t1, $t2, $t3); +try { + ($t1, $t2, $t3) = strike qw/B425907E5755031BDA4A8D1B6DCCACA97DA14C04 5D4FD5A64E436A831383773F85FB38B888B9ECC9 85DF191A921C20B2DDAFF72368CAB93BA18C5ACE/; +} catch { + diag 'Error while calling strike:', "\n", Dumper $_ +}; subtest 'order' => sub { plan tests => 3; -- 2.39.2