Subject: | IPv6 with SSL works fine with IO::Socket::SSL |
Date: | Sun, 30 Jul 2017 21:36:55 +0200 |
To: | bug-Net-IMAP-Simple [...] rt.cpan.org |
From: | Moritz Bunkus <moritz [...] bunkus.org> |
Hey,
if both "use_ssl" and "use_ipv6" is set, Net::IMAP::Simple carps with an
error message that the combination is not supported. However, it does
work very well with small modifications to the source. Please remove
that error and apply the changes I'll describe below.
Reading current IO::Socket::SSL documentation[1] states the following:
Show quoted text
> * If IO::Socket::IP with at least version 0.20 is installed it will
> use this module as super class, transparently providing IPv6 and
> IPv4 support.
> * If IO::Socket::INET6 is installed it will use this module as super
> class, transparently providing IPv6 and IPv4 support.
Therefore I've redefined Net::IMAP::Simple::_sock_from to test for
"use_ssl" first like this (one line, wrapped only for email):
sub _sock_from {
return $_[0]->{use_ssl} ? 'IO::Socket::SSL'
: $_[0]->{use_v6} ? 'IO::Socket::INET6'
: 'IO::Socket::INET'
}
Using the following code works just fine afterwards:
------------------------------------------------------------
my $imap = Net::IMAP::Simple->new(
'the-hostname',
port => 993,
use_v6 => 1,
use_ssl => 1,
shutup_about_v6ssl => 1,
);
$imap->login('the-user', 'secret');
print join("\n", sort({ $a cmp $b } $imap->mailboxes_subscribed)), "\n";
$imap->quit;
------------------------------------------------------------
So please:
a) remove the test for "use_v6 && use_ssl" with the following "carp"
in "new" and
b) change "_sock_from" as I've shown above.
Thanks!
Kind regards,
mosu
[1] http://search.cpan.org/~sullr/IO-Socket-SSL-2.049/lib/IO/Socket/SSL.pod