Skip to content

Instantly share code, notes, and snippets.

@issm
Created January 3, 2013 06:28
Show Gist options
  • Save issm/4441257 to your computer and use it in GitHub Desktop.
Save issm/4441257 to your computer and use it in GitHub Desktop.
### Furl::HTTP::connect_ssl をオーバライドする
package Furl::HTTP;
use IO::Socket::SSL;
{
no warnings 'redefine';
no strict 'refs';
*Furl::HTTP::connect_ssl = sub {
my ($self, $host, $port, $timeout_at) = @_;
_requires('IO/Socket/SSL.pm', 'SSL');
my $timeout = $timeout_at - time;
return (undef, "Cannot create SSL connection: timeout")
if $timeout <= 0;
my $sock = IO::Socket::SSL->new(
PeerHost => $host,
PeerPort => $port,
Timeout => $timeout,
SSL_verify_mode => SSL_VERIFY_NONE, # warning を回避
) or return (undef, "Cannot create SSL connection: $!");
_set_sockopts($sock);
$sock;
};
}
1;
package main;
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment