chansen/p5-http-tiny — pull request #7 by doherty (2012-04-04 16:13:43+00:00)
Title: Allow setting IO::Socket::SSL's certificate verification scheme

Fixes GH #6

You might also want to incorporate a test such as this basic one. I don't know how stable the bad-ness of spinrite.com's cert is... I probably wouldn't rely on that.

```perl
use strict;
use warnings;
use IO::Socket::SSL;
# BEGIN { $IO::Socket::SSL::DEBUG = 3 }
use HTTP::Tiny;
use Test::More;

plan $ENV{AUTOMATED_TESTING}
? (tests => 2)
: (skip_all => "Only run for \$ENV{AUTOMATED_TESTING}");

{
my $http = HTTP::Tiny->new(
ssl_opts => {
verify_hostname_scheme => { callback => sub { 1 } },
}
);

# bad SSL cert, force success
my $response = $http->get('https://www.spinrite.com/');
ok $response->{success}, 'bad SSL cert, forced success'
or diag explain [$response, $http];
}

{
my $http = HTTP::Tiny->new(
ssl_opts => {
verify_hostname_scheme => { callback => sub { 0 } },
}
);

my $response = $http->get('https://www.google.com/');
ok !$response->{success}, 'good SSL cert, forced failure'
or diag explain [$response, $http];
}
```