Skip to content

Test failures on IPv6 systems #19

Open

Description

@richardleach

Hi,

Three HTTP::Async test files establish a listening HTTP service using IO::Socket::INET, attempt to test that service using "http://localhost:$port" url_roots, and then run into the problem on hosts with IPv6 that localhost resolves to ::1 rather than 127.0.0.1 and so connections to the test service will fail.

  1. t/dead-connection.t - could be fixed by either using IO::Socket::IP rather than IO::Socket::INET, or by explicitly creating the request using 127.0.0.1:

my $req = HTTP::Request->new( GET => "http://127.0.0.1:$port/" );

I don't know which is the more portable solution.

  1. In both t/bad-connections.t and
  2. t/peer-addr.t

TestServer->new() results in an IPv4 socket being created.
$s->started_ok() returns "http://localhost:$port"

I've submitted a bug for Test::HTTP::Server::Simple (https://rt.cpan.org/Public/Bug/Display.html?id=124363) with a suggestion that would address these two cases, as well as possibly any other modules that follow the Test::HTTP::Server::Simple synopsis.

Otherwise, these two cases could be addressed by the test files using "http://127.0.0.1:$port"rather than the string returned by started_ok().

With both suggestions, 127.0.0.1 might not be a fully portable assumption, but the number of people that might catch out is probably a lot smaller than the number of people having IPv6 capable hosts.

Many Thanks,
Rich

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions