Skip Menu |

This queue is for tickets about the Net-IMAP-Simple CPAN distribution.

Report information
The Basics
Id: 122653
Status: open
Priority: 0/
Queue: Net-IMAP-Simple

People
Owner: Nobody in particular
Requestors: moritz [...] bunkus.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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
From: tlhackque [...] yahoo.com
+1 for IPv6 support. However, I suggest IO::Socket::IP, as it will handle IPv4 & IPv6 - automatically selecting the address from those in DNS. use_ipv6 can be used to force IPv6; I suggest 0 = IPv4 only, 1 = IPv6 only and undef = auto. This should be compatible with current usage.
These seem like relatively simple changes. I'll +1 that too. Shoot me a PR here if you're completely tired of waiting for me. https://github.com/jettero/net--imap--simple On Sun Jul 30 15:40:33 2017, moritz@bunkus.org wrote: Show quoted text
> 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: >
> > * 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
-- If riding in an airplane is flying, then riding in a boat is swimming. 116 jumps, 48.6 minutes of freefall, 92.9 freefall miles.