Subject: | Arg length for inet_ntoa |
"Bad arg length for Socket::inet_ntoa, length is 16, should be 4" at
HTTP/Daemon.pm line 48
All this is about the sub url in the module. If you have
IO::Socket::INET6 installed, using HTTP::Daemon with, say, Gepok, will
throw an error when you send the sockname ($addr here, in the sub url)
to inet_ntoa. Because IO::Socket::SSL will use INET6 if it is installed.
INET6 sends a 16-byte string when you ask for sockaddr, and inet_ntoa
chokes. So, I have a patch to use the Sys::hostname value for the $url,
not only if the two conditions there are met, but also if $self isa
IO::Socket::INET6. Which avoids sending the too-long string to inet_ntoa.
The patch is attached and below:
@@ -40,7 +40,7 @@ sub url
my $self = shift;
my $url = $self->_default_scheme . "://";
my $addr = $self->sockaddr;
- if (!$addr || $addr eq INADDR_ANY) {
+ if (!$addr || $addr eq INADDR_ANY || $self->isa('IO::Socket::INET6')) {
require Sys::Hostname;
$url .= lc Sys::Hostname::hostname();
}
Amiri
Subject: | http-daemon.patch |
diff -rupN HTTP-Daemon-6.00/lib/HTTP/Daemon.pm HTTP-Daemon-6.01/lib/HTTP/Daemon.pm
--- HTTP-Daemon-6.00/lib/HTTP/Daemon.pm 2011-02-27 14:46:57.000000000 -0800
+++ HTTP-Daemon-6.01/lib/HTTP/Daemon.pm 2011-10-01 16:20:08.503026398 -0700
@@ -40,7 +40,7 @@ sub url
my $self = shift;
my $url = $self->_default_scheme . "://";
my $addr = $self->sockaddr;
- if (!$addr || $addr eq INADDR_ANY) {
+ if (!$addr || $addr eq INADDR_ANY || $self->isa('IO::Socket::INET6')) {
require Sys::Hostname;
$url .= lc Sys::Hostname::hostname();
}