I have a http server that uses the module HTTP::AppServer from cpan.
I can connect to my server using 127.0.0.1 or localhost, while it miserably fails with ::1.
Here are some example with curl:
$ curl http://127.0.0.1:8080/index.html
This is a test.
$ curl -g http://[::1]:8080/index.html
curl: (7) couldn't connect to host
This is how the server is started:
use HTTP::AppServer;
use IO::Socket::IP -register;
my $server = HTTP::AppServer->new( StartBackground => 0, ServerPort => 8080 );
$server->plugin('FileRetriever', DocRoot => '/tmp');
$server->start;
Actually it is a lot more complicated. But it I don’t think all the rest of the script is necessary. I’ve added the module IO::Socket::IP and upgraded the module Socket to the version found here in order to make IO::Socket::IP to work.
Still, It doesn’t work.
After LeoNerd saying that IO::Socket::IP can’t help me in this situation, I’ve found an alternative solution, although this solution works only with some perl version.
HTTP::AppServer is based on HTTP::Server::Simple and I found on cpan a newer version of this second module that supports ipv6.
First of all you need to download the newer version of HTTP::Server::Simple here:
http://metacpan.org/pod/HTTP::Server::Simple
As you can see, it has a different
newmethod that accept a new argumentfamily.Now you have to take the HTTP::AppServer.pm and modify the
initfunction fromto
Unfortunately, this answer the question, but not my problem because it doesn’t work with perl 5.8.8 also upgrading Socket.pm to the latest version.