summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xPorting/Maintainers.pl2
-rw-r--r--cpan/libnet/Makefile.PL5
-rw-r--r--cpan/libnet/lib/Net/Cmd.pm38
-rw-r--r--cpan/libnet/lib/Net/Config.pm4
-rw-r--r--cpan/libnet/lib/Net/Domain.pm2
-rw-r--r--cpan/libnet/lib/Net/FTP.pm53
-rw-r--r--cpan/libnet/lib/Net/FTP/A.pm2
-rw-r--r--cpan/libnet/lib/Net/FTP/E.pm2
-rw-r--r--cpan/libnet/lib/Net/FTP/I.pm2
-rw-r--r--cpan/libnet/lib/Net/FTP/L.pm2
-rw-r--r--cpan/libnet/lib/Net/FTP/dataconn.pm2
-rw-r--r--cpan/libnet/lib/Net/NNTP.pm41
-rw-r--r--cpan/libnet/lib/Net/Netrc.pm2
-rw-r--r--cpan/libnet/lib/Net/POP3.pm33
-rw-r--r--cpan/libnet/lib/Net/SMTP.pm36
-rw-r--r--cpan/libnet/lib/Net/Time.pm2
-rw-r--r--cpan/libnet/t/datasend.t9
17 files changed, 152 insertions, 85 deletions
diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index c258f7d4da..19467cb8c8 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -705,7 +705,7 @@ use File::Glob qw(:case);
},
'libnet' => {
- 'DISTRIBUTION' => 'SHAY/libnet-3.06.tar.gz',
+ 'DISTRIBUTION' => 'SHAY/libnet-3.07.tar.gz',
'FILES' => q[cpan/libnet],
'EXCLUDED' => [
qw( Configure
diff --git a/cpan/libnet/Makefile.PL b/cpan/libnet/Makefile.PL
index af2497645a..872eac8ffd 100644
--- a/cpan/libnet/Makefile.PL
+++ b/cpan/libnet/Makefile.PL
@@ -7,7 +7,7 @@
# Makefile creation script.
#
# COPYRIGHT
-# Copyright (C) 2014 Steve Hay. All rights reserved.
+# Copyright (C) 2014, 2015 Steve Hay. All rights reserved.
#
# LICENCE
# This script is free software; you can redistribute it and/or modify it under
@@ -66,7 +66,7 @@ MAIN: {
ABSTRACT => 'Collection of network protocol modules',
AUTHOR => 'Graham Barr <gbarr@pobox.com>, Steve Hay <shay@cpan.org>',
LICENSE => 'perl_5',
- VERSION => '3.06',
+ VERSION => '3.07',
META_MERGE => {
'meta-spec' => {
@@ -206,6 +206,7 @@ MAIN: {
'Time::Local' => '0',
'constant' => '0',
'strict' => '0',
+ 'utf8' => '0',
'vars' => '0'
},
diff --git a/cpan/libnet/lib/Net/Cmd.pm b/cpan/libnet/lib/Net/Cmd.pm
index f56e9045da..3bf5ec6899 100644
--- a/cpan/libnet/lib/Net/Cmd.pm
+++ b/cpan/libnet/lib/Net/Cmd.pm
@@ -2,7 +2,7 @@
#
# Versions up to 2.29_1 Copyright (c) 1995-2006 Graham Barr <gbarr@pobox.com>.
# All rights reserved.
-# Changes in Version 2.29_2 onwards Copyright (C) 2013-2014 Steve Hay. All
+# Changes in Version 2.29_2 onwards Copyright (C) 2013-2015 Steve Hay. All
# rights reserved.
# This module is free software; you can redistribute it and/or modify it under
# the same terms as Perl itself, i.e. under the terms of either the GNU General
@@ -27,22 +27,7 @@ BEGIN {
}
}
-BEGIN {
- if (!eval { require utf8 }) {
- *is_utf8 = sub { 0 };
- }
- elsif (eval { utf8::is_utf8(undef); 1 }) {
- *is_utf8 = \&utf8::is_utf8;
- }
- elsif (eval { require Encode; Encode::is_utf8(undef); 1 }) {
- *is_utf8 = \&Encode::is_utf8;
- }
- else {
- *is_utf8 = sub { $_[0] =~ /[^\x00-\xff]/ };
- }
-}
-
-our $VERSION = "3.06";
+our $VERSION = "3.07";
our @ISA = qw(Exporter);
our @EXPORT = qw(CMD_INFO CMD_OK CMD_MORE CMD_REJECT CMD_ERROR CMD_PENDING);
@@ -429,9 +414,17 @@ sub datasend {
my $arr = @_ == 1 && ref($_[0]) ? $_[0] : \@_;
my $line = join("", @$arr);
- # encode to individual utf8 bytes if
- # $line is a string (in internal UTF-8)
- utf8::encode($line) if is_utf8($line);
+ # Perls < 5.10.1 (with the exception of 5.8.9) have a performance problem with
+ # the substitutions below when dealing with strings stored internally in
+ # UTF-8, so downgrade them (if possible).
+ # Data passed to datasend() should be encoded to octets upstream already so
+ # shouldn't even have the UTF-8 flag on to start with, but if it so happens
+ # that the octets are stored in an upgraded string (as can sometimes occur)
+ # then they would still downgrade without fail anyway.
+ # Only Unicode codepoints > 0xFF stored in an upgraded string will fail to
+ # downgrade. We fail silently in that case, and a "Wide character in print"
+ # warning will be emitted later by syswrite().
+ utf8::downgrade($line, 1) if $] < 5.010001 && $] != 5.008009;
return 0
if $cmd->_is_closed;
@@ -722,6 +715,8 @@ is pending then C<CMD_PENDING> is returned.
Send data to the remote server, converting LF to CRLF. Any line starting
with a '.' will be prefixed with another '.'.
C<DATA> may be an array or a reference to an array.
+The C<DATA> passed in must be encoded by the caller to octets of whatever
+encoding is required, e.g. by using the Encode module's C<encode()> function.
=item dataend ()
@@ -794,6 +789,9 @@ Unget a line of text from the server.
Send data to the remote server without performing any conversions. C<DATA>
is a scalar.
+As with C<datasend()>, the C<DATA> passed in must be encoded by the caller
+to octets of whatever encoding is required, e.g. by using the Encode module's
+C<encode()> function.
=item read_until_dot ()
diff --git a/cpan/libnet/lib/Net/Config.pm b/cpan/libnet/lib/Net/Config.pm
index a705065b06..fe8ce8a88d 100644
--- a/cpan/libnet/lib/Net/Config.pm
+++ b/cpan/libnet/lib/Net/Config.pm
@@ -20,7 +20,7 @@ use Socket qw(inet_aton inet_ntoa);
our @EXPORT = qw(%NetConfig);
our @ISA = qw(Net::LocalCfg Exporter);
-our $VERSION = "3.06";
+our $VERSION = "3.07";
our($CONFIGURE, $LIBNET_CFG);
@@ -134,7 +134,7 @@ __END__
Net::Config - Local configuration data for libnet
-=head1 SYNOPSYS
+=head1 SYNOPSIS
use Net::Config qw(%NetConfig);
diff --git a/cpan/libnet/lib/Net/Domain.pm b/cpan/libnet/lib/Net/Domain.pm
index 0fde92dcb0..3109f43c8f 100644
--- a/cpan/libnet/lib/Net/Domain.pm
+++ b/cpan/libnet/lib/Net/Domain.pm
@@ -21,7 +21,7 @@ use Net::Config;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(hostname hostdomain hostfqdn domainname);
-our $VERSION = "3.06";
+our $VERSION = "3.07";
my ($host, $domain, $fqdn) = (undef, undef, undef);
diff --git a/cpan/libnet/lib/Net/FTP.pm b/cpan/libnet/lib/Net/FTP.pm
index 8b746632d5..7700bb366b 100644
--- a/cpan/libnet/lib/Net/FTP.pm
+++ b/cpan/libnet/lib/Net/FTP.pm
@@ -2,7 +2,7 @@
#
# Versions up to 2.77_2 Copyright (c) 1995-2004 Graham Barr <gbarr@pobox.com>.
# All rights reserved.
-# Changes in Version 2.77_3 onwards Copyright (C) 2013-2014 Steve Hay. All
+# Changes in Version 2.77_3 onwards Copyright (C) 2013-2015 Steve Hay. All
# rights reserved.
# This module is free software; you can redistribute it and/or modify it under
# the same terms as Perl itself, i.e. under the terms of either the GNU General
@@ -25,9 +25,10 @@ use Net::Config;
use Socket;
use Time::Local;
-our $VERSION = '3.06';
+our $VERSION = '3.07';
our $IOCLASS;
+my $family_key;
BEGIN {
# Code for detecting if we can use SSL
my $ssl_class = eval {
@@ -55,6 +56,10 @@ BEGIN {
sub can_inet6 { $inet6_class };
$IOCLASS = $ssl_class || $inet6_class || 'IO::Socket::INET';
+ $family_key =
+ ( $ssl_class ? $ssl_class->can_ipv6 : $inet6_class || '' )
+ eq 'IO::Socket::IP'
+ ? 'Family' : 'Domain';
}
our @ISA = ('Exporter','Net::Cmd',$IOCLASS);
@@ -120,6 +125,7 @@ sub new {
PeerAddr => $peer,
PeerPort => $arg{Port} || ($arg{SSL} ? 'ftps(990)' : 'ftp(21)'),
LocalAddr => $arg{'LocalAddr'},
+ $family_key => $arg{Domain} || $arg{Family},
Proto => 'tcp',
Timeout => defined $arg{Timeout} ? $arg{Timeout} : 120,
%tlsargs,
@@ -131,6 +137,7 @@ sub new {
${*$ftp}{'net_ftp_blksize'} = abs($arg{'BlockSize'} || 10240);
${*$ftp}{'net_ftp_localaddr'} = $arg{'LocalAddr'};
+ ${*$ftp}{'net_ftp_domain'} = $arg{Domain} || $arg{Family};
${*$ftp}{'net_ftp_firewall'} = $fire
if (defined $fire);
@@ -662,8 +669,12 @@ sub rmdir {
or !$recurse;
# Try to delete the contents
- # Get a list of all the files in the directory
- my @filelist = grep { !/^\.{1,2}$/ } $ftp->ls($dir);
+ # Get a list of all the files in the directory, excluding the current and parent directories
+ my @filelist = map { /^(?:\S+;)+ (.+)$/ ? ($1) : () } grep { !/^(?:\S+;)*type=[cp]dir;/ } $ftp->_list_cmd("MLSD", $dir);
+
+ # Fallback to using the less well-defined NLST command if MLSD fails
+ @filelist = grep { !/^\.{1,2}$/ } $ftp->ls($dir)
+ unless @filelist;
return
unless @filelist; # failed, it is probably not a directory
@@ -889,6 +900,7 @@ sub _eprt {
Listen => 1,
Timeout => $ftp->timeout,
LocalAddr => $ftp->sockhost,
+ $family_key => $ftp->sockdomain,
can_ssl() ? (
%{ ${*$ftp}{net_ftp_tlsargs} },
SSL_startHandshake => 0,
@@ -1035,6 +1047,7 @@ sub _dataconn {
PeerAddr => $pasv->[0],
PeerPort => $pasv->[1],
LocalAddr => ${*$ftp}{net_ftp_localaddr},
+ $family_key => ${*$ftp}{net_ftp_domain},
Timeout => $ftp->timeout,
can_ssl() ? (
SSL_startHandshake => 0,
@@ -1142,7 +1155,7 @@ sub _data_cmd {
my $data = $ftp->_dataconn();
if (CMD_INFO == $ftp->response()) {
$data->reading
- if $data && $cmd =~ /RETR|LIST|NLST/;
+ if $data && $cmd =~ /RETR|LIST|NLST|MLSD/;
return $data;
}
$data->_close if $data;
@@ -1181,7 +1194,7 @@ sub _data_cmd {
my $data = $ftp->_dataconn();
$data->reading
- if $data && $cmd =~ /RETR|LIST|NLST/;
+ if $data && $cmd =~ /RETR|LIST|NLST|MLSD/;
return $data;
}
@@ -1435,10 +1448,15 @@ Net::FTP - FTP Client class
=head1 DESCRIPTION
C<Net::FTP> is a class implementing a simple FTP client in Perl as
-described in RFC959. It provides wrappers for a subset of the RFC959
-commands.
+described in RFC959. It provides wrappers for the commonly used subset of the
+RFC959 commands.
+If L<IO::Socket::IP> or L<IO::Socket::INET6> is installed it also provides
+support for IPv6 as defined in RFC2428.
+And with L<IO::Socket::SSL> installed it provides support for implicit FTPS
+and explicit FTPS as defined in RFC4217.
-The Net::FTP class is a subclass of Net::Cmd and IO::Socket::INET.
+The Net::FTP class is a subclass of Net::Cmd and (depending on avaibility) of
+IO::Socket::IP, IO::Socket::INET6 or IO::Socket::INET.
=head1 OVERVIEW
@@ -1539,8 +1557,15 @@ simply invokes the C<hash()> method for you, so that hash marks
are displayed for all transfers. You can, of course, call C<hash()>
explicitly whenever you'd like.
-B<LocalAddr> - Local address to use for all socket connections, this
-argument will be passed to L<IO::Socket::INET>
+B<LocalAddr> - Local address to use for all socket connections. This
+argument will be passed to the super class, i.e. L<IO::Socket::INET>
+or L<IO::Socket::IP>.
+
+B<Domain> - Domain to use, i.e. AF_INET or AF_INET6. This
+argument will be passed to the IO::Socket super class.
+This can be used to enforce IPv4 even with L<IO::Socket::IP>
+which would default to IPv6.
+B<Family> is accepted as alternative name for B<Domain>.
If the constructor fails undef will be returned and an error message will
be in $@
@@ -1592,8 +1617,8 @@ Only C<LEVEL>s "C" (clear) and "P" (private) are supported.
=item host ()
-Returns the value used by the constructor, and passed to IO::Socket::INET,
-to connect to the host.
+Returns the value used by the constructor, and passed to the IO::Socket super
+class to connect to the host.
=item account( ACCT )
@@ -2014,7 +2039,7 @@ Roderick Schertler <roderick@gate.net> - for various inputs
=head1 COPYRIGHT
Versions up to 2.77_2 Copyright (c) 1995-2004 Graham Barr. All rights reserved.
-Changes in Version 2.77_3 onwards Copyright (C) 2013-2014 Steve Hay. All rights
+Changes in Version 2.77_3 onwards Copyright (C) 2013-2015 Steve Hay. All rights
reserved.
This module is free software; you can redistribute it and/or modify it under the
diff --git a/cpan/libnet/lib/Net/FTP/A.pm b/cpan/libnet/lib/Net/FTP/A.pm
index 7eee970d88..f3375c63e3 100644
--- a/cpan/libnet/lib/Net/FTP/A.pm
+++ b/cpan/libnet/lib/Net/FTP/A.pm
@@ -13,7 +13,7 @@ use Carp;
use Net::FTP::dataconn;
our @ISA = qw(Net::FTP::dataconn);
-our $VERSION = "3.06";
+our $VERSION = "3.07";
our $buf;
diff --git a/cpan/libnet/lib/Net/FTP/E.pm b/cpan/libnet/lib/Net/FTP/E.pm
index ad36441906..56075f67b2 100644
--- a/cpan/libnet/lib/Net/FTP/E.pm
+++ b/cpan/libnet/lib/Net/FTP/E.pm
@@ -8,6 +8,6 @@ use warnings;
use Net::FTP::I;
our @ISA = qw(Net::FTP::I);
-our $VERSION = "3.06";
+our $VERSION = "3.07";
1;
diff --git a/cpan/libnet/lib/Net/FTP/I.pm b/cpan/libnet/lib/Net/FTP/I.pm
index c5603c67cd..bb18ff8c7c 100644
--- a/cpan/libnet/lib/Net/FTP/I.pm
+++ b/cpan/libnet/lib/Net/FTP/I.pm
@@ -13,7 +13,7 @@ use Carp;
use Net::FTP::dataconn;
our @ISA = qw(Net::FTP::dataconn);
-our $VERSION = "3.06";
+our $VERSION = "3.07";
our $buf;
diff --git a/cpan/libnet/lib/Net/FTP/L.pm b/cpan/libnet/lib/Net/FTP/L.pm
index 4c5297010e..d96a39bc0b 100644
--- a/cpan/libnet/lib/Net/FTP/L.pm
+++ b/cpan/libnet/lib/Net/FTP/L.pm
@@ -8,6 +8,6 @@ use warnings;
use Net::FTP::I;
our @ISA = qw(Net::FTP::I);
-our $VERSION = "3.06";
+our $VERSION = "3.07";
1;
diff --git a/cpan/libnet/lib/Net/FTP/dataconn.pm b/cpan/libnet/lib/Net/FTP/dataconn.pm
index 980e21d383..81e3a61188 100644
--- a/cpan/libnet/lib/Net/FTP/dataconn.pm
+++ b/cpan/libnet/lib/Net/FTP/dataconn.pm
@@ -13,7 +13,7 @@ use Carp;
use Errno;
use Net::Cmd;
-our $VERSION = '3.06';
+our $VERSION = '3.07';
$Net::FTP::IOCLASS or die "please load Net::FTP before Net::FTP::dataconn";
our @ISA = $Net::FTP::IOCLASS;
diff --git a/cpan/libnet/lib/Net/NNTP.pm b/cpan/libnet/lib/Net/NNTP.pm
index 75f7bf1dd4..7499204575 100644
--- a/cpan/libnet/lib/Net/NNTP.pm
+++ b/cpan/libnet/lib/Net/NNTP.pm
@@ -2,7 +2,7 @@
#
# Versions up to 2.24_1 Copyright (c) 1995-1997 Graham Barr <gbarr@pobox.com>.
# All rights reserved.
-# Changes in Version 2.25 onwards Copyright (C) 2013-2014 Steve Hay. All rights
+# Changes in Version 2.25 onwards Copyright (C) 2013-2015 Steve Hay. All rights
# reserved.
# This module is free software; you can redistribute it and/or modify it under
# the same terms as Perl itself, i.e. under the terms of either the GNU General
@@ -21,7 +21,7 @@ use Net::Cmd;
use Net::Config;
use Time::Local;
-our $VERSION = "3.06";
+our $VERSION = "3.07";
# Code for detecting if we can use SSL
my $ssl_class = eval {
@@ -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.
+The Net::NNTP class is a subclass of Net::Cmd and (depending on avaibility) of
+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 specific local address 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
@@ -947,15 +956,17 @@ implementation) from the server. Returns the text or undef upon failure.
The C<ihave> command informs the server that the client has an article
whose id is C<MSGID>. If the server desires a copy of that
-article, and C<MESSAGE> has been given the it will be sent.
+article and C<MESSAGE> has been given then it will be sent.
Returns I<true> if the server desires the article and C<MESSAGE> was
-successfully sent,if specified.
+successfully sent, if specified.
If C<MESSAGE> is not specified then the message must be sent using the
C<datasend> and C<dataend> methods from L<Net::Cmd>
-C<MESSAGE> can be either an array of lines or a reference to an array.
+C<MESSAGE> can be either an array of lines or a reference to an array
+and must be encoded by the caller to octets of whatever encoding is required,
+e.g. by using the Encode module's C<encode()> function.
=item last ()
@@ -1028,7 +1039,9 @@ is allowed then the message will be sent.
If C<MESSAGE> is not specified then the message must be sent using the
C<datasend> and C<dataend> methods from L<Net::Cmd>
-C<MESSAGE> can be either an array of lines or a reference to an array.
+C<MESSAGE> can be either an array of lines or a reference to an array
+and must be encoded by the caller to octets of whatever encoding is required,
+e.g. by using the Encode module's C<encode()> function.
The message, either sent via C<datasend> or as the C<MESSAGE>
parameter, must be in the format as described by RFC822 and must
@@ -1279,7 +1292,7 @@ Steve Hay E<lt>F<shay@cpan.org>E<gt> is now maintaining libnet as of version
=head1 COPYRIGHT
Versions up to 2.24_1 Copyright (c) 1995-1997 Graham Barr. All rights reserved.
-Changes in Version 2.25 onwards Copyright (C) 2013-2014 Steve Hay. All rights
+Changes in Version 2.25 onwards Copyright (C) 2013-2015 Steve Hay. All rights
reserved.
This module is free software; you can redistribute it and/or modify it under the
diff --git a/cpan/libnet/lib/Net/Netrc.pm b/cpan/libnet/lib/Net/Netrc.pm
index efa38cb84c..4b721be107 100644
--- a/cpan/libnet/lib/Net/Netrc.pm
+++ b/cpan/libnet/lib/Net/Netrc.pm
@@ -18,7 +18,7 @@ use warnings;
use Carp;
use FileHandle;
-our $VERSION = "3.06";
+our $VERSION = "3.07";
our $TESTING;
diff --git a/cpan/libnet/lib/Net/POP3.pm b/cpan/libnet/lib/Net/POP3.pm
index 2c38819f98..791b1d28d5 100644
--- a/cpan/libnet/lib/Net/POP3.pm
+++ b/cpan/libnet/lib/Net/POP3.pm
@@ -2,7 +2,7 @@
#
# Versions up to 2.29 Copyright (c) 1995-2004 Graham Barr <gbarr@pobox.com>.
# All rights reserved.
-# Changes in Version 2.29_01 onwards Copyright (C) 2013-2014 Steve Hay. All
+# Changes in Version 2.29_01 onwards Copyright (C) 2013-2015 Steve Hay. All
# rights reserved.
# This module is free software; you can redistribute it and/or modify it under
# the same terms as Perl itself, i.e. under the terms of either the GNU General
@@ -20,7 +20,7 @@ use IO::Socket;
use Net::Cmd;
use Net::Config;
-our $VERSION = "3.06";
+our $VERSION = "3.07";
# Code for detecting if we can use SSL
my $ssl_class = eval {
@@ -34,16 +34,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 };
@@ -63,7 +66,6 @@ sub new {
}
my $hosts = defined $host ? [$host] : $NetConfig{pop3_hosts};
my $obj;
- my @localport = exists $arg{ResvPort} ? (LocalPort => $arg{ResvPort}) : ();
if ($arg{SSL}) {
# SSL from start
@@ -78,7 +80,9 @@ sub new {
PeerAddr => ($host = $h),
PeerPort => $arg{Port} || 'pop3(110)',
Proto => 'tcp',
- @localport,
+ $family_key => $arg{Domain} || $arg{Family},
+ LocalAddr => $arg{LocalAddr},
+ LocalPort => exists($arg{ResvPort}) ? $arg{ResvPort} : $arg{LocalPort},
Timeout => $arg{Timeout},
)
and last;
@@ -623,12 +627,16 @@ Net::POP3 - Post Office Protocol 3 Client class (RFC1939)
This module implements a client interface to the POP3 protocol, enabling
a perl5 application to talk to POP3 servers. This documentation assumes
that you are familiar with the POP3 protocol described in RFC1939.
+With L<IO::Socket::SSL> installed it also provides support for implicit and
+explicit TLS encryption, i.e. POP3S or POP3+STARTTLS.
A new Net::POP3 object must be created with the I<new> method. Once
this has been done, all POP3 commands are accessed via method calls
on the object.
-The Net::POP3 class is a subclass of Net::Cmd and IO::Socket::INET.
+The Net::POP3 class is a subclass of Net::Cmd and (depending on avaibility) of
+IO::Socket::IP, IO::Socket::INET6 or IO::Socket::INET.
+
=head1 CONSTRUCTOR
@@ -659,9 +667,14 @@ upgrade with C<starttls>.
You can use SSL arguments as documented in L<IO::Socket::SSL>, but it will
usually use the right arguments already.
-B<ResvPort> - If given then the socket for the C<Net::POP3> object
-will be bound to the local port given using C<bind> when the socket is
-created.
+B<LocalAddr> and B<LocalPort> - These parameters are passed directly
+to IO::Socket to allow binding the socket to a specific local address and port.
+For compatibility with older versions B<ResvPort> can be used instead of
+B<LocalPort>.
+
+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.
B<Timeout> - Maximum time, in seconds, to wait for a response from the
POP3 server (default: 120)
@@ -840,7 +853,7 @@ Steve Hay E<lt>F<shay@cpan.org>E<gt> is now maintaining libnet as of version
=head1 COPYRIGHT
Versions up to 2.29 Copyright (c) 1995-2004 Graham Barr. All rights reserved.
-Changes in Version 2.29_01 onwards Copyright (C) 2013-2014 Steve Hay. All
+Changes in Version 2.29_01 onwards Copyright (C) 2013-2015 Steve Hay. All
rights reserved.
This module is free software; you can redistribute it and/or modify it under the
diff --git a/cpan/libnet/lib/Net/SMTP.pm b/cpan/libnet/lib/Net/SMTP.pm
index 05f251996c..7a703d991f 100644
--- a/cpan/libnet/lib/Net/SMTP.pm
+++ b/cpan/libnet/lib/Net/SMTP.pm
@@ -2,7 +2,7 @@
#
# Versions up to 2.31_1 Copyright (c) 1995-2004 Graham Barr <gbarr@pobox.com>.
# All rights reserved.
-# Changes in Version 2.31_2 onwards Copyright (C) 2013-2014 Steve Hay. All
+# Changes in Version 2.31_2 onwards Copyright (C) 2013-2015 Steve Hay. All
# rights reserved.
# This module is free software; you can redistribute it and/or modify it under
# the same terms as Perl itself, i.e. under the terms of either the GNU General
@@ -21,7 +21,7 @@ use Net::Cmd;
use Net::Config;
use Socket;
-our $VERSION = "3.06";
+our $VERSION = "3.07";
# Code for detecting if we can use SSL
my $ssl_class = eval {
@@ -35,10 +35,12 @@ 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';
@@ -80,6 +82,7 @@ sub new {
PeerPort => $arg{Port} || 'smtp(25)',
LocalAddr => $arg{LocalAddr},
LocalPort => $arg{LocalPort},
+ $family_key => $arg{Domain} || $arg{Family},
Proto => 'tcp',
Timeout => $arg{Timeout}
)
@@ -651,12 +654,12 @@ Net::SMTP - Simple Mail Transfer Protocol Client
This module implements a client interface to the SMTP and ESMTP
protocol, enabling a perl5 application to talk to SMTP servers. This
documentation assumes that you are familiar with the concepts of the
-SMTP protocol described in RFC821.
+SMTP protocol described in RFC2821.
+With L<IO::Socket::SSL> installed it also provides support for implicit and
+explicit TLS encryption, i.e. SMTPS or SMTP+STARTTLS.
-A new Net::SMTP object must be created with the I<new> method. Once
-this has been done, all SMTP commands are accessed through this object.
-
-The Net::SMTP class is a subclass of Net::Cmd and IO::Socket::INET.
+The Net::SMTP class is a subclass of Net::Cmd and (depending on avaibility) of
+IO::Socket::IP, IO::Socket::INET6 or IO::Socket::INET.
=head1 EXAMPLES
@@ -734,7 +737,11 @@ You can use SSL arguments as documented in L<IO::Socket::SSL>, but it will
usually use the right arguments already.
B<LocalAddr> and B<LocalPort> - These parameters are passed directly
-to IO::Socket to allow binding the socket to a local port.
+to IO::Socket to allow binding the socket to a specific local address 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.
B<Timeout> - Maximum time, in seconds, to wait for a response from the
SMTP server (default: 120)
@@ -942,9 +949,12 @@ Synonyms for C<recipient>.
Initiate the sending of the data from the current message.
-C<DATA> may be a reference to a list or a list. If specified the contents
-of C<DATA> and a termination string C<".\r\n"> is sent to the server. And the
-result will be true if the data was accepted.
+C<DATA> may be a reference to a list or a list and must be encoded by the
+caller to octets of whatever encoding is required, e.g. by using the Encode
+module's C<encode()> function.
+
+If specified the contents of C<DATA> and a termination string C<".\r\n"> is
+sent to the server. The result will be true if the data was accepted.
If C<DATA> is not specified then the result will indicate that the server
wishes the data to be sent. The data must then be sent using the C<datasend>
@@ -1018,7 +1028,7 @@ Steve Hay E<lt>F<shay@cpan.org>E<gt> is now maintaining libnet as of version
=head1 COPYRIGHT
Versions up to 2.31_1 Copyright (c) 1995-2004 Graham Barr. All rights reserved.
-Changes in Version 2.31_2 onwards Copyright (C) 2013-2014 Steve Hay. All rights
+Changes in Version 2.31_2 onwards Copyright (C) 2013-2015 Steve Hay. All rights
reserved.
This module is free software; you can redistribute it and/or modify it under the
diff --git a/cpan/libnet/lib/Net/Time.pm b/cpan/libnet/lib/Net/Time.pm
index eea2e71319..aaddface7d 100644
--- a/cpan/libnet/lib/Net/Time.pm
+++ b/cpan/libnet/lib/Net/Time.pm
@@ -24,7 +24,7 @@ use Net::Config;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(inet_time inet_daytime);
-our $VERSION = "3.06";
+our $VERSION = "3.07";
our $TIMEOUT = 120;
diff --git a/cpan/libnet/t/datasend.t b/cpan/libnet/t/datasend.t
index 3a97c4ba47..0aea9d4a39 100644
--- a/cpan/libnet/t/datasend.t
+++ b/cpan/libnet/t/datasend.t
@@ -44,7 +44,7 @@ BEGIN {
(my $libnet_t = __FILE__) =~ s/datasend.t/libnet_t.pl/;
require $libnet_t or die;
-print "1..51\n";
+print "1..54\n";
sub check {
my $expect = pop;
@@ -158,3 +158,10 @@ check(
"a\015\012..\015\012.\015\012",
);
+# Test that datasend() plays nicely with bytes in an upgraded string,
+# even though the input should really be encode()d already.
+check(
+ substr("\x{100}", 0, 0) . "\x{e9}",
+
+ "\x{e9}\015\012.\015\012"
+);