From 2a59724c16c204887061581e901136a397ef2329 Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Tue, 4 Jan 2011 17:04:47 +0000 Subject: [PATCH] Support emulation of AI_NUMERICSERV even though it's not strictly RFC 2553, because most OSes support it anyway, and it's easy to do --- ext/Socket/Socket.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ext/Socket/Socket.pm b/ext/Socket/Socket.pm index 6e0f95b..a34fa77 100644 --- a/ext/Socket/Socket.pm +++ b/ext/Socket/Socket.pm @@ -596,6 +596,9 @@ if( !defined &getaddrinfo ) { AI_PASSIVE => 1, AI_CANONNAME => 2, AI_NUMERICHOST => 4, + # RFC 2553 doesn't define this but Linux does - lets be nice and + # provide it since we can + AI_NUMERICSERV => 1024, EAI_BADFLAGS => -1, EAI_NONAME => -2, @@ -663,6 +666,7 @@ sub fake_getaddrinfo my $flag_passive = $flags & AI_PASSIVE(); $flags &= ~AI_PASSIVE(); my $flag_canonname = $flags & AI_CANONNAME(); $flags &= ~AI_CANONNAME(); my $flag_numerichost = $flags & AI_NUMERICHOST(); $flags &= ~AI_NUMERICHOST(); + my $flag_numericserv = $flags & AI_NUMERICSERV(); $flags &= ~AI_NUMERICSERV(); $flags == 0 or return fake_makeerr( EAI_BADFLAGS() ); @@ -689,6 +693,7 @@ sub fake_getaddrinfo } if( $service ne "" and $service !~ m/^\d+$/ ) { + return fake_makeerr( EAI_NONAME() ) if( $flag_numericserv ); getservbyname( $service, $protname ) or return fake_makeerr( EAI_SERVICE() ); } -- 2.7.4