diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2014-02-25 11:04:29 +0000 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2014-02-25 11:41:12 +0000 |
commit | f728ea121a319b376bb24026acdaa56996bffb02 (patch) | |
tree | 91382826587d84096c1db495bdcec80f0be05b87 /cpan/IO-Socket-IP | |
parent | 845ab12d77c07580053486e445977dc895d747f8 (diff) | |
download | perl-f728ea121a319b376bb24026acdaa56996bffb02.tar.gz |
Update IO-Socket-IP to CPAN version 0.29
[DELTA]
0.29 2014/02/24 16:06:29
[BUGFIXES]
* Workaround for OSes that disobey AI_ADDRCONFIG and yield AIs on
families the kernel will not support anyway (e.g. HPUX)
* Workaround for OSes that lack getprotobyname() (e.g. Android)
Diffstat (limited to 'cpan/IO-Socket-IP')
-rw-r--r-- | cpan/IO-Socket-IP/Changes | 6 | ||||
-rw-r--r-- | cpan/IO-Socket-IP/META.json | 6 | ||||
-rw-r--r-- | cpan/IO-Socket-IP/META.yml | 14 | ||||
-rw-r--r-- | cpan/IO-Socket-IP/Makefile.PL | 2 | ||||
-rw-r--r-- | cpan/IO-Socket-IP/lib/IO/Socket/IP.pm | 30 | ||||
-rw-r--r-- | cpan/IO-Socket-IP/t/19no-addrs.t | 13 |
6 files changed, 47 insertions, 24 deletions
diff --git a/cpan/IO-Socket-IP/Changes b/cpan/IO-Socket-IP/Changes index ef3f7388d3..e647142955 100644 --- a/cpan/IO-Socket-IP/Changes +++ b/cpan/IO-Socket-IP/Changes @@ -1,5 +1,11 @@ Revision history for IO-Socket-IP +0.29 2014/02/24 16:06:29 + [BUGFIXES] + * Workaround for OSes that disobey AI_ADDRCONFIG and yield AIs on + families the kernel will not support anyway (e.g. HPUX) + * Workaround for OSes that lack getprotobyname() (e.g. Android) + 0.28 2014/02/10 16:17:59 [CHANGES] * Renamed internal _configure method to _io_socket_ip__configure to diff --git a/cpan/IO-Socket-IP/META.json b/cpan/IO-Socket-IP/META.json index 66b1744ced..b6e43908dc 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.4203", + "generated_by" : "Module::Build version 0.4204", "license" : [ "perl_5" ], @@ -29,7 +29,7 @@ "provides" : { "IO::Socket::IP" : { "file" : "lib/IO/Socket/IP.pm", - "version" : "0.28" + "version" : "0.29" } }, "release_status" : "stable", @@ -38,5 +38,5 @@ "http://dev.perl.org/licenses/" ] }, - "version" : "0.28" + "version" : "0.29" } diff --git a/cpan/IO-Socket-IP/META.yml b/cpan/IO-Socket-IP/META.yml index 9e8bb03ddd..f860cc059d 100644 --- a/cpan/IO-Socket-IP/META.yml +++ b/cpan/IO-Socket-IP/META.yml @@ -3,21 +3,21 @@ abstract: 'Family-neutral IP socket supporting both IPv4 and IPv6' author: - 'Paul Evans <leonerd@leonerd.org.uk>' build_requires: - Test::More: 0.88 + Test::More: '0.88' dynamic_config: 1 -generated_by: 'Module::Build version 0.4203, CPAN::Meta::Converter version 2.133380' +generated_by: 'Module::Build version 0.4204, CPAN::Meta::Converter version 2.133380' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 + version: '1.4' name: IO-Socket-IP provides: IO::Socket::IP: file: lib/IO/Socket/IP.pm - version: 0.28 + version: '0.29' requires: - IO::Socket: 0 - Socket: 1.97 + IO::Socket: '0' + Socket: '1.97' resources: license: http://dev.perl.org/licenses/ -version: 0.28 +version: '0.29' diff --git a/cpan/IO-Socket-IP/Makefile.PL b/cpan/IO-Socket-IP/Makefile.PL index ba9c840d75..796159de1c 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.4203 +# Note: this file was auto-generated by Module::Build::Compat version 0.4204 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 44d057f6aa..30e0464d70 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.28'; + $VERSION = '0.29'; } use strict; @@ -35,6 +35,9 @@ use Errno qw( EINVAL EINPROGRESS EISCONN ); use constant HAVE_MSWIN32 => ( $^O eq "MSWin32" ); +# At least one OS (Android) is known not to have getprotobyname() +use constant HAVE_GETPROTOBYNAME => defined eval { getprotobyname( "tcp" ) }; + my $IPv6_re = do { # translation of RFC 3986 3.2.2 ABNF to re my $IPv4address = do { @@ -394,7 +397,9 @@ sub _io_socket_ip__configure if( defined( my $proto = $arg->{Proto} ) ) { unless( $proto =~ m/^\d+$/ ) { - my $protonum = getprotobyname( $proto ); + my $protonum = HAVE_GETPROTOBYNAME + ? getprotobyname( $proto ) + : eval { Socket->${\"IPPROTO_\U$proto"}() }; defined $protonum or croak "Unrecognised protocol $proto"; $proto = $protonum; } @@ -518,24 +523,27 @@ sub _io_socket_ip__configure if( !@infos ) { # If there was a Family hint then create a plain unbound, unconnected socket + if( defined $hints{family} ) { + @infos = ( { + family => $hints{family}, + socktype => $hints{socktype}, + protocol => $hints{protocol}, + } ); + } # If there wasn't, use getaddrinfo()'s AI_ADDRCONFIG side-effect to guess a # suitable family first. - if( !defined $hints{family} ) { - my ( $err, $addrinfo ) = getaddrinfo( "", "0", \%hints ); + else { + ( my $err, @infos ) = getaddrinfo( "", "0", \%hints ); if( $err ) { $@ = "$err"; $! = EINVAL; return; } - $hints{family} = $addrinfo->{family}; + # We'll take all the @infos anyway, because some OSes (HPUX) are known to + # ignore the AI_ADDRCONFIG hint and return AF_INET6 even if they don't + # support them } - - @infos = ( { - family => $hints{family}, - socktype => $hints{socktype}, - protocol => $hints{protocol}, - } ); } # In the nonblocking case, caller will be calling ->setup multiple times. diff --git a/cpan/IO-Socket-IP/t/19no-addrs.t b/cpan/IO-Socket-IP/t/19no-addrs.t index 0ccb84f5fe..f26eff415a 100644 --- a/cpan/IO-Socket-IP/t/19no-addrs.t +++ b/cpan/IO-Socket-IP/t/19no-addrs.t @@ -13,6 +13,9 @@ use Socket qw( SOCK_STREAM AF_INET ); { my $sock = IO::Socket::IP->new( Family => AF_INET ); + my $save_exc = $@; + ok( defined $sock, 'Constructor yields handle for Family => AF_INET' ) or + diag( "Exception was $save_exc" ); ok( defined $sock->fileno, '$sock->fileno for Family => AF_INET' ); is( $sock->sockdomain, AF_INET, '$sock->sockdomain for Family => AF_INET' ); @@ -21,12 +24,15 @@ use Socket qw( SOCK_STREAM AF_INET ); SKIP: { my $AF_INET6 = eval { require Socket and Socket::AF_INET6() } or - skip "No AF_INET6", 3; + skip "No AF_INET6", 4; eval { IO::Socket::IP->new( LocalHost => "::1" ) } or - skip "Unable to bind to ::1", 3; + skip "Unable to bind to ::1", 4; my $sock = IO::Socket::IP->new( Family => $AF_INET6 ); + my $save_exc = $@; + ok( defined $sock, 'Constructor yields handle for Family => AF_INET6' ) or + diag( "Exception was $save_exc" ); ok( defined $sock->fileno, '$sock->fileno for Family => AF_INET6' ); is( $sock->sockdomain, $AF_INET6, '$sock->sockdomain for Family => AF_INET6' ); @@ -37,6 +43,9 @@ SKIP: { # what family { my $sock = IO::Socket::IP->new( Type => SOCK_STREAM ); + my $save_exc = $@; + ok( defined $sock, 'Constructor yields handle for Type => SOCK_STREAM' ) or + diag( "Exception was $save_exc" ); ok( defined $sock->fileno, '$sock->fileno for Type => SOCK_STREAM' ); is( $sock->socktype, SOCK_STREAM, '$sock->socktype for Type => SOCK_STREAM' ); |