The following code ...
my $user_agent = LWP::UserAgent->new;
my $request = HTTP::Request->new(GET => $url);
my $response = $user_agent->request($request);
if ($response->is_success) {
print "OK\n";
} else {
die($response->status_line);
}
.. will fail with ..
500 Can't connect to <hostname> (Bad hostname '<hostname>')
.. if the hostname in $url is an IPv6 only address (that is: presence of an AAAA
record, but no A
record).
My questions are:
- How do I enable IPv6 support in LWP?
- How do I configure LWP's settings for "prefer-IPv4-over-IPv6" (
A
vs.AAAA
) / "prefer-IPv6-over-IPv4" (AAAA
vs.A
)?