Skip Menu |

This queue is for tickets about the HTTP-Daemon CPAN distribution.

Report information
The Basics
Id: 71395
Status: resolved
Priority: 0/
Queue: HTTP-Daemon

People
Owner: Nobody in particular
Requestors: amiribarksdale [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 6.00
Fixed in: (no value)



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(); }
I don't understand how you get into this situation. Did you explicitly override the HTTP::Daemon::ISA to be IO::Socket::INET6 instead?
Subject: Re: [rt.cpan.org #71395] Arg length for inet_ntoa
Date: Sat, 18 Feb 2012 10:27:57 -0800
To: "Gisle_Aas via RT" <bug-HTTP-Daemon [...] rt.cpan.org>
From: amiribarksdale [...] gmail.com
On Sat, Feb 18, 2012 at 07:20:50AM -0500, Gisle_Aas via RT wrote: | <URL: https://rt.cpan.org/Ticket/Display.html?id=71395 > | | I don't understand how you get into this situation. Did you explicitly override the | HTTP::Daemon::ISA to be IO::Socket::INET6 instead? I did not explicitly override, but IO::Socket::SSL will use IO::Socket::INET6 if it is installed, which produced the problem. Amiri
Does this mean that you are using HTTP::Daemon::SSL then?
Subject: Re: [rt.cpan.org #71395] Arg length for inet_ntoa
Date: Sun, 19 Feb 2012 03:48:13 -0800
To: "Gisle_Aas via RT" <bug-HTTP-Daemon [...] rt.cpan.org>
From: Amiri Barksdale <abarksdale [...] campusexplorer.com>
On Sun, Feb 19, 2012 at 05:29:08AM -0500, Gisle_Aas via RT wrote: | <URL: https://rt.cpan.org/Ticket/Display.html?id=71395 > | | Does this mean that you are using HTTP::Daemon::SSL then? Yes, the software uses both HTTP::Daemon and HTTP::Daemon::SSL. Also HTTP::Daemon::UNIX. Amiri
On Sun Feb 19 06:48:26 2012, abarksdale@campusexplorer.com wrote: Show quoted text
> On Sun, Feb 19, 2012 at 05:29:08AM -0500, Gisle_Aas via RT wrote: > | <URL: https://rt.cpan.org/Ticket/Display.html?id=71395 > > | > | Does this mean that you are using HTTP::Daemon::SSL then? > > Yes, the software uses both HTTP::Daemon and HTTP::Daemon::SSL. Also > HTTP::Daemon::UNIX. > > Amiri
Writer of Gepok here. I wonder whether the appropriate patch should be directed to HTTP::Daemon::SSL (I'm guessing yes?) But currently I'm using Amiri's patch myself on my deployment targets. Regards, Steven
On Mon Mar 05 10:49:01 2012, SHARYANTO wrote: Show quoted text
> On Sun Feb 19 06:48:26 2012, abarksdale@campusexplorer.com wrote:
> > On Sun, Feb 19, 2012 at 05:29:08AM -0500, Gisle_Aas via RT wrote: > > | <URL: https://rt.cpan.org/Ticket/Display.html?id=71395 > > > | > > | Does this mean that you are using HTTP::Daemon::SSL then? > > > > Yes, the software uses both HTTP::Daemon and HTTP::Daemon::SSL. Also > > HTTP::Daemon::UNIX. > > > > Amiri
> > Writer of Gepok here. I wonder whether the appropriate patch should
be Show quoted text
> directed to HTTP::Daemon::SSL (I'm guessing yes?) > > But currently I'm using Amiri's patch myself on my deployment targets. > > Regards, > Steven
Btw, the kind folks at PerlMonks have also suggested simply to uninstall IO::Socket::INET6 (at least on Debian, by uninstalling libio- socket-inet6-perl). Works for me, haven't tested on other platform. Ref: http://www.perlmonks.org/?node_id=948946
From: ppisar [...] redhat.com
Dne So 01.říj.2011 19:29:38, AMIRI napsal(a): Show quoted text
> "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. >
Port to IO::Socket::IP should fix it <https://rt.cpan.org/Public/Bug/Display.html?id=91699>.