From 1cc5fa02b062482e80110d08e24b10cfcdb52fc2 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Thu, 12 May 2011 22:27:14 -0700 Subject: [PATCH] Further IPv6 inetd fix https://sourceforge.net/tracker/?func=detail&atid=117457&aid=3300507&group_id=17457 --- miniserv.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/miniserv.pl b/miniserv.pl index 03bf1b8c1..98c7affd2 100755 --- a/miniserv.pl +++ b/miniserv.pl @@ -421,14 +421,15 @@ if ($config{'inetd'}) { } # Work out the hostname for this web server - $host = &get_socket_name(SOCK, 0); + local $sn = getsockname(SOCK); + $ipv6 = length($sn) > 16; + $host = &get_socket_name(SOCK, $ipv6); $host || exit; $port = $config{'port'}; $acptaddr = getpeername(SOCK); $acptaddr || exit; # Work out remote and local IPs - $ipv6 = length($acptaddr) > 16; (undef, $peera, undef) = &get_address_ip($acptaddr, $ipv6); (undef, $locala) = &get_socket_ip(SOCK, $ipv6);