Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

perl support IPv6 address format [::1] in HTTP::Request

Tags:

http

perl

ipv6

Debian Wheezy (perl 5.14)

Work nice:

use LWP::Simple;
print get( 'http://ip6-localhost:80' );

Not working (1)

use LWP::Simple;
print get( 'http://[::1]:80' );

Not working (2) [Return: Bad hostname]

use LWP::Simple;
$ua = new LWP::UserAgent();
my $req = new HTTP::Request("GET", "http://[::1]/");
my $res = $ua->request($req);

Not working (3) [Return: Connection refused]

use Net::INET6Glue::INET_is_INET6;
use LWP::Simple;
$ua = new LWP::UserAgent();
my $req = new HTTP::Request("GET", "http://[::1]/");
my $res = $ua->request($req);

Why I need it? Because ldirectord need it. :( Any suggestion?

like image 961
Ondrej Prochazka Avatar asked Jun 19 '12 07:06

Ondrej Prochazka


1 Answers

Another post suggested using INET6Glue

use Net::INET6Glue::INET_is_INET6;
use LWP::Simple;
print get( 'http://[::1]:80' );
print get( 'http://ipv6.google.com' );
like image 53
CodeSmith Avatar answered Oct 07 '22 21:10

CodeSmith