about summary refs log tree commit
path: root/lib/Net/NNTP.pm
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2015-07-16 12:53:46 +0100
committerSteve Hay <steve.m.hay@googlemail.com>2015-07-16 12:53:46 +0100
commit49d04d766190e6549afead3db1013e3a87fddfe7 (patch)
tree674bf249d0b02c7bcd24d1134a493e0006bc8731 /lib/Net/NNTP.pm
parentfd7861d7a88a9520f8ef6db21fb16385f7104401 (diff)
parent8b327f42811280415f924aa21f66dd72337b9bbc (diff)
downloadperl-libnet-49d04d766190e6549afead3db1013e3a87fddfe7.tar.gz
Merge pull request #18 from noxxi/af_domain
let FTP, NNTP, POP3, SMTP restrict Domain to IPv4 even if IPv6 is sup…
Diffstat (limited to 'lib/Net/NNTP.pm')
-rw-r--r--lib/Net/NNTP.pm21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/Net/NNTP.pm b/lib/Net/NNTP.pm
index b9c5d6f..8fb2d64 100644
--- a/lib/Net/NNTP.pm
+++ b/lib/Net/NNTP.pm
@@ -35,16 +35,19 @@ my $nossl_warn = !$ssl_class &&
   'To use SSL please install IO::Socket::SSL with version>=2.007';
 
 # Code for detecting if we can use IPv6
+my $family_key = 'Domain';
 my $inet6_class = eval {
   require IO::Socket::IP;
   no warnings 'numeric';
-  IO::Socket::IP->VERSION(0.20);
+  IO::Socket::IP->VERSION(0.20) || die;
+  $family_key = 'Family';
 } && 'IO::Socket::IP' || eval {
   require IO::Socket::INET6;
   no warnings 'numeric';
   IO::Socket::INET6->VERSION(2.62);
 } && 'IO::Socket::INET6';
 
+
 sub can_ssl   { $ssl_class };
 sub can_inet6 { $inet6_class };
 
@@ -81,9 +84,10 @@ sub new {
     $connect{$_} = $arg{$_} for(grep { m{^SSL_} } keys %arg);
   }
 
-  foreach my $o (qw(LocalAddr Timeout)) {
+  foreach my $o (qw(LocalAddr LocalPort Timeout)) {
     $connect{$o} = $arg{$o} if exists $arg{$o};
   }
+  $connect{$family_key} = $arg{Domain} || $arg{Family};
   $connect{Timeout} = 120 unless defined $connect{Timeout};
   $connect{PeerPort} = $arg{Port} || 'nntp(119)';
   foreach my $h (@{$hosts}) {
@@ -799,8 +803,11 @@ Net::NNTP - NNTP Client class
 
 C<Net::NNTP> is a class implementing a simple NNTP client in Perl as described
 in RFC977 and RFC4642.
+With L<IO::Socket::SSL> installed it also provides support for implicit and
+explicit TLS encryption, i.e. NNTPS or NNTP+STARTTLS.
 
 The Net::NNTP class is a subclass of Net::Cmd and IO::Socket::INET.
+IO::Socket::IP, IO::Socket::INET6 or IO::Socket::INET.
 
 =head1 CONSTRUCTOR
 
@@ -843,10 +850,12 @@ so that the remote server becomes innd. If the C<Reader> option is given
 with a value of zero, then this command will not be sent and the
 connection will be left talking to nnrpd.
 
-B<LocalAddr> - If multiple IP addresses are present on the client host
-with a valid route to the destination, you can specify the address your
-C<Net::NNTP> connects from and this way override the operating system's
-pick.
+B<LocalAddr> and B<LocalPort> - These parameters are passed directly
+to IO::Socket to allow binding the socket to a a specific local addr and port.
+
+B<Domain> - This parameter is passed directly to IO::Socket and makes it
+possible to enforce IPv4 connections even if L<IO::Socket::IP> is used as super
+class. Alternatively B<Family> can be used.
 
 =back