diff options
author | Tom Hukins <tom@eborcom.com> | 2014-01-21 19:48:09 +0000 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2014-02-05 08:41:04 +1100 |
commit | f1e79f7400f00330d45e4a394715a28f2e0b36bc (patch) | |
tree | c46e55d06e8cd67e36e0bb036ab0817e3692ab42 /cpan/IO-Socket-IP | |
parent | 39acb20de3c851a2234b55cc03e06433c4efdd1d (diff) | |
download | perl-f1e79f7400f00330d45e4a394715a28f2e0b36bc.tar.gz |
Upgrade IO::Socket::IP to version 0.27
Diffstat (limited to 'cpan/IO-Socket-IP')
-rw-r--r-- | cpan/IO-Socket-IP/Changes | 7 | ||||
-rw-r--r-- | cpan/IO-Socket-IP/META.json | 6 | ||||
-rw-r--r-- | cpan/IO-Socket-IP/META.yml | 6 | ||||
-rw-r--r-- | cpan/IO-Socket-IP/Makefile.PL | 2 | ||||
-rw-r--r-- | cpan/IO-Socket-IP/lib/IO/Socket/IP.pm | 2 | ||||
-rw-r--r-- | cpan/IO-Socket-IP/t/01local-client-v4.t | 7 | ||||
-rw-r--r-- | cpan/IO-Socket-IP/t/02local-server-v4.t | 7 | ||||
-rw-r--r-- | cpan/IO-Socket-IP/t/04local-client-v6.t | 26 | ||||
-rw-r--r-- | cpan/IO-Socket-IP/t/05local-server-v6.t | 26 | ||||
-rw-r--r-- | cpan/IO-Socket-IP/t/30nonblocking-connect.t | 6 | ||||
-rw-r--r-- | cpan/IO-Socket-IP/t/31nonblocking-connect-internet.t | 2 |
11 files changed, 65 insertions, 32 deletions
diff --git a/cpan/IO-Socket-IP/Changes b/cpan/IO-Socket-IP/Changes index 4c7842a745..7f2624e955 100644 --- a/cpan/IO-Socket-IP/Changes +++ b/cpan/IO-Socket-IP/Changes @@ -1,5 +1,12 @@ Revision history for IO-Socket-IP +0.27 2014/01/20 18:08:31 + [BUGFIXES] + * Apply a short timeout to unit tests that probe for internet + connectivity, in case of bad firewalls, etc... (Perl RT121037) + * Defend against machines with IN6ADDR_LOOPBACK not being "::1" in + unit tests, similar to the INADDR_LOOPBACK case (RT92295) + 0.26 2014/01/16 12:20:02 [CHANGES] * Set $VERSION in BEGIN block before 'use base' so that diff --git a/cpan/IO-Socket-IP/META.json b/cpan/IO-Socket-IP/META.json index 4cbc5c9244..2bc1290a7d 100644 --- a/cpan/IO-Socket-IP/META.json +++ b/cpan/IO-Socket-IP/META.json @@ -4,7 +4,7 @@ "Paul Evans <leonerd@leonerd.org.uk>" ], "dynamic_config" : 1, - "generated_by" : "Module::Build version 0.4202", + "generated_by" : "Module::Build version 0.4203", "license" : [ "perl_5" ], @@ -29,7 +29,7 @@ "provides" : { "IO::Socket::IP" : { "file" : "lib/IO/Socket/IP.pm", - "version" : "0.26" + "version" : "0.27" } }, "release_status" : "stable", @@ -38,5 +38,5 @@ "http://dev.perl.org/licenses/" ] }, - "version" : "0.26" + "version" : "0.27" } diff --git a/cpan/IO-Socket-IP/META.yml b/cpan/IO-Socket-IP/META.yml index 481427b3bc..7aa66badfd 100644 --- a/cpan/IO-Socket-IP/META.yml +++ b/cpan/IO-Socket-IP/META.yml @@ -5,7 +5,7 @@ author: build_requires: Test::More: 0.88 dynamic_config: 1 -generated_by: 'Module::Build version 0.4202, CPAN::Meta::Converter version 2.133380' +generated_by: 'Module::Build version 0.4203, CPAN::Meta::Converter version 2.133380' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -14,10 +14,10 @@ name: IO-Socket-IP provides: IO::Socket::IP: file: lib/IO/Socket/IP.pm - version: 0.26 + version: 0.27 requires: IO::Socket: 0 Socket: 1.97 resources: license: http://dev.perl.org/licenses/ -version: 0.26 +version: 0.27 diff --git a/cpan/IO-Socket-IP/Makefile.PL b/cpan/IO-Socket-IP/Makefile.PL index 7547ce3fd6..ba9c840d75 100644 --- a/cpan/IO-Socket-IP/Makefile.PL +++ b/cpan/IO-Socket-IP/Makefile.PL @@ -1,4 +1,4 @@ -# Note: this file was auto-generated by Module::Build::Compat version 0.4202 +# Note: this file was auto-generated by Module::Build::Compat version 0.4203 use ExtUtils::MakeMaker; WriteMakefile ( diff --git a/cpan/IO-Socket-IP/lib/IO/Socket/IP.pm b/cpan/IO-Socket-IP/lib/IO/Socket/IP.pm index e8d3a20135..11ecf3bf4e 100644 --- a/cpan/IO-Socket-IP/lib/IO/Socket/IP.pm +++ b/cpan/IO-Socket-IP/lib/IO/Socket/IP.pm @@ -7,7 +7,7 @@ package IO::Socket::IP; # $VERSION needs to be set before use base 'IO::Socket' # - https://rt.cpan.org/Ticket/Display.html?id=92107 BEGIN { - $VERSION = '0.26'; + $VERSION = '0.27'; } use strict; diff --git a/cpan/IO-Socket-IP/t/01local-client-v4.t b/cpan/IO-Socket-IP/t/01local-client-v4.t index 99b232b9de..9a7a94d1ed 100644 --- a/cpan/IO-Socket-IP/t/01local-client-v4.t +++ b/cpan/IO-Socket-IP/t/01local-client-v4.t @@ -8,13 +8,14 @@ use Test::More; use IO::Socket::IP; use IO::Socket::INET; -use Socket qw( inet_ntoa unpack_sockaddr_in ); +use Socket qw( inet_aton inet_ntoa pack_sockaddr_in unpack_sockaddr_in ); # Some odd locations like BSD jails might not like INADDR_LOOPBACK. We'll # establish a baseline first to test against my $INADDR_LOOPBACK = do { - my $localsock = IO::Socket::INET->new( LocalAddr => "localhost", Listen => 1 ); - $localsock->sockaddr; + socket my $sockh, PF_INET, SOCK_STREAM, 0 or die "Cannot socket(PF_INET) - $!"; + bind $sockh, pack_sockaddr_in( 0, inet_aton( "127.0.0.1" ) ) or die "Cannot bind() - $!"; + ( unpack_sockaddr_in( getsockname $sockh ) )[1]; }; my $INADDR_LOOPBACK_HOST = inet_ntoa( $INADDR_LOOPBACK ); if( $INADDR_LOOPBACK ne INADDR_LOOPBACK ) { diff --git a/cpan/IO-Socket-IP/t/02local-server-v4.t b/cpan/IO-Socket-IP/t/02local-server-v4.t index 5ce757d2e6..d1f2b40f45 100644 --- a/cpan/IO-Socket-IP/t/02local-server-v4.t +++ b/cpan/IO-Socket-IP/t/02local-server-v4.t @@ -8,13 +8,14 @@ use Test::More; use IO::Socket::IP; use IO::Socket::INET; -use Socket qw( inet_ntoa unpack_sockaddr_in ); +use Socket qw( inet_aton inet_ntoa pack_sockaddr_in unpack_sockaddr_in ); # Some odd locations like BSD jails might not like INADDR_LOOPBACK. We'll # establish a baseline first to test against my $INADDR_LOOPBACK = do { - my $localsock = IO::Socket::INET->new( LocalAddr => "localhost", Listen => 1 ); - $localsock->sockaddr; + socket my $sockh, PF_INET, SOCK_STREAM, 0 or die "Cannot socket(PF_INET) - $!"; + bind $sockh, pack_sockaddr_in( 0, inet_aton( "127.0.0.1" ) ) or die "Cannot bind() - $!"; + ( unpack_sockaddr_in( getsockname $sockh ) )[1]; }; my $INADDR_LOOPBACK_HOST = inet_ntoa( $INADDR_LOOPBACK ); if( $INADDR_LOOPBACK ne INADDR_LOOPBACK ) { diff --git a/cpan/IO-Socket-IP/t/04local-client-v6.t b/cpan/IO-Socket-IP/t/04local-client-v6.t index 6932d4ddbc..5c55367c4b 100644 --- a/cpan/IO-Socket-IP/t/04local-client-v6.t +++ b/cpan/IO-Socket-IP/t/04local-client-v6.t @@ -6,13 +6,23 @@ use warnings; use Test::More; use IO::Socket::IP; -use Socket; +use Socket qw( inet_pton inet_ntop pack_sockaddr_in6 unpack_sockaddr_in6 IN6ADDR_LOOPBACK ); -my $AF_INET6 = eval { require Socket and Socket::AF_INET6() } or +my $AF_INET6 = eval { Socket::AF_INET6() } or plan skip_all => "No AF_INET6"; -eval { IO::Socket::IP->new( LocalHost => "::1" ) } or - plan skip_all => "Unable to bind to ::1"; +# Some odd locations like BSD jails might not like IN6ADDR_LOOPBACK. We'll +# establish a baseline first to test against +my $IN6ADDR_LOOPBACK = eval { + socket my $sockh, Socket::PF_INET6(), SOCK_STREAM, 0 or die "Cannot socket(PF_INET6) - $!"; + bind $sockh, pack_sockaddr_in6( 0, inet_pton( $AF_INET6, "::1" ) ) or die "Cannot bind() - $!"; + ( unpack_sockaddr_in6( getsockname $sockh ) )[1]; +} or plan skip_all => "Unable to bind to ::1 - $@"; +my $IN6ADDR_LOOPBACK_HOST = inet_ntop( $AF_INET6, $IN6ADDR_LOOPBACK ); +if( $IN6ADDR_LOOPBACK ne IN6ADDR_LOOPBACK ) { + diag( "Testing with IN6ADDR_LOOPBACK=$IN6ADDR_LOOPBACK_HOST; this may be because of odd networking" ); +} +my $IN6ADDR_LOOPBACK_HEX = unpack "H*", $IN6ADDR_LOOPBACK; # Unpack just ip6_addr and port because other fields might not match end to end sub unpack_sockaddr_in6_addrport { @@ -63,14 +73,14 @@ foreach my $socktype (qw( SOCK_STREAM SOCK_DGRAM )) { [ unpack_sockaddr_in6_addrport( $testclient->sockname ) ], "\$socket->peername for $socktype" ); - is( $socket->peerhost, "::1", "\$socket->peerhost for $socktype" ); - is( $socket->peerport, $testport, "\$socket->peerport for $socktype" ); + is( $socket->peerhost, $IN6ADDR_LOOPBACK_HOST, "\$socket->peerhost for $socktype" ); + is( $socket->peerport, $testport, "\$socket->peerport for $socktype" ); # Unpack just so it pretty prints without wrecking the terminal if it fails - is( unpack("H*", $socket->peeraddr), "0000"x7 . "0001", "\$socket->peeraddr for $socktype" ); + is( unpack("H*", $socket->peeraddr), $IN6ADDR_LOOPBACK_HEX, "\$testclient->peeraddr for $socktype" ); if( $socktype eq "SOCK_STREAM" ) { # Some OSes don't update sockaddr with a local bind() on SOCK_DGRAM sockets - is( unpack("H*", $socket->sockaddr), "0000"x7 . "0001", "\$socket->sockaddr for $socktype" ); + is( unpack("H*", $socket->sockaddr), $IN6ADDR_LOOPBACK_HEX, "\$testclient->sockaddr for $socktype" ); } # Can't easily test the non-numeric versions without relying on the system's diff --git a/cpan/IO-Socket-IP/t/05local-server-v6.t b/cpan/IO-Socket-IP/t/05local-server-v6.t index cadc9b75f1..2be2683805 100644 --- a/cpan/IO-Socket-IP/t/05local-server-v6.t +++ b/cpan/IO-Socket-IP/t/05local-server-v6.t @@ -6,13 +6,23 @@ use warnings; use Test::More; use IO::Socket::IP; -use Socket; +use Socket qw( inet_pton inet_ntop pack_sockaddr_in6 unpack_sockaddr_in6 IN6ADDR_LOOPBACK ); -my $AF_INET6 = eval { require Socket and Socket::AF_INET6() } or +my $AF_INET6 = eval { Socket::AF_INET6() } or plan skip_all => "No AF_INET6"; -eval { IO::Socket::IP->new( LocalHost => "::1" ) } or - plan skip_all => "Unable to bind to ::1"; +# Some odd locations like BSD jails might not like IN6ADDR_LOOPBACK. We'll +# establish a baseline first to test against +my $IN6ADDR_LOOPBACK = eval { + socket my $sockh, Socket::PF_INET6(), SOCK_STREAM, 0 or die "Cannot socket(PF_INET6) - $!"; + bind $sockh, pack_sockaddr_in6( 0, inet_pton( $AF_INET6, "::1" ) ) or die "Cannot bind() - $!"; + ( unpack_sockaddr_in6( getsockname $sockh ) )[1]; +} or plan skip_all => "Unable to bind to ::1 - $@"; +my $IN6ADDR_LOOPBACK_HOST = inet_ntop( $AF_INET6, $IN6ADDR_LOOPBACK ); +if( $IN6ADDR_LOOPBACK ne IN6ADDR_LOOPBACK ) { + diag( "Testing with IN6ADDR_LOOPBACK=$IN6ADDR_LOOPBACK_HOST; this may be because of odd networking" ); +} +my $IN6ADDR_LOOPBACK_HEX = unpack "H*", $IN6ADDR_LOOPBACK; # Unpack just ip6_addr and port because other fields might not match end to end sub unpack_sockaddr_in6_addrport { @@ -32,8 +42,8 @@ foreach my $socktype (qw( SOCK_STREAM SOCK_DGRAM )) { is( $testserver->sockdomain, $AF_INET6, "\$testserver->sockdomain for $socktype" ); is( $testserver->socktype, Socket->$socktype, "\$testserver->socktype for $socktype" ); - is( $testserver->sockhost, "::1", "\$testserver->sockhost for $socktype" ); - like( $testserver->sockport, qr/^\d+$/, "\$testserver->sockport for $socktype" ); + is( $testserver->sockhost, $IN6ADDR_LOOPBACK_HOST, "\$testserver->sockhost for $socktype" ); + like( $testserver->sockport, qr/^\d+$/, "\$testserver->sockport for $socktype" ); my $socket = IO::Socket->new; $socket->socket( $AF_INET6, Socket->$socktype, 0 ) @@ -69,10 +79,10 @@ foreach my $socktype (qw( SOCK_STREAM SOCK_DGRAM )) { is( $testclient->peerport, $sockport, "\$testclient->peerport for $socktype" ); # Unpack just so it pretty prints without wrecking the terminal if it fails - is( unpack("H*", $testclient->peeraddr), "0000"x7 . "0001", "\$testclient->peeraddr for $socktype" ); + is( unpack("H*", $testclient->peeraddr), $IN6ADDR_LOOPBACK_HEX, "\$testclient->peeraddr for $socktype" ); if( $socktype eq "SOCK_STREAM" ) { # Some OSes don't update sockaddr with a local bind() on SOCK_DGRAM sockets - is( unpack("H*", $testclient->sockaddr), "0000"x7 . "0001", "\$testclient->sockaddr for $socktype" ); + is( unpack("H*", $testclient->sockaddr), $IN6ADDR_LOOPBACK_HEX, "\$testclient->sockaddr for $socktype" ); } } diff --git a/cpan/IO-Socket-IP/t/30nonblocking-connect.t b/cpan/IO-Socket-IP/t/30nonblocking-connect.t index 5ac32d25be..518bd2ebd8 100644 --- a/cpan/IO-Socket-IP/t/30nonblocking-connect.t +++ b/cpan/IO-Socket-IP/t/30nonblocking-connect.t @@ -8,13 +8,15 @@ use Test::More; use IO::Socket::IP; use IO::Socket::INET; +use Socket qw( inet_aton inet_ntoa pack_sockaddr_in unpack_sockaddr_in ); use Errno qw( EINPROGRESS EWOULDBLOCK ); # Some odd locations like BSD jails might not like INADDR_LOOPBACK. We'll # establish a baseline first to test against my $INADDR_LOOPBACK = do { - my $localsock = IO::Socket::INET->new( LocalAddr => "localhost", Listen => 1 ); - $localsock->sockaddr; + socket my $sockh, PF_INET, SOCK_STREAM, 0 or die "Cannot socket(PF_INET) - $!"; + bind $sockh, pack_sockaddr_in( 0, inet_aton( "127.0.0.1" ) ) or die "Cannot bind() - $!"; + ( unpack_sockaddr_in( getsockname $sockh ) )[1]; }; my $INADDR_LOOPBACK_HOST = inet_ntoa( $INADDR_LOOPBACK ); if( $INADDR_LOOPBACK ne INADDR_LOOPBACK ) { diff --git a/cpan/IO-Socket-IP/t/31nonblocking-connect-internet.t b/cpan/IO-Socket-IP/t/31nonblocking-connect-internet.t index b236205f91..8dc3ca05ea 100644 --- a/cpan/IO-Socket-IP/t/31nonblocking-connect-internet.t +++ b/cpan/IO-Socket-IP/t/31nonblocking-connect-internet.t @@ -20,6 +20,7 @@ SKIP: { PeerHost => $test_host, PeerPort => $test_good_port, Type => SOCK_STREAM, + Timeout => 3, ) or skip "Can't connect to $test_host:$test_good_port", 5; my $socket = IO::Socket::IP->new( @@ -57,6 +58,7 @@ SKIP: { PeerHost => $test_host, PeerPort => $test_bad_port, Type => SOCK_STREAM, + Timeout => 3, ) and skip "Connecting to $test_host:$test_bad_port succeeds", 4; $! == ECONNREFUSED or skip "Connecting to $test_host:$test_bad_port doesn't give ECONNREFUSED", 4; |