diff --git a/META.json b/META.json index 46464ca6..155dabd3 100644 --- a/META.json +++ b/META.json @@ -87,7 +87,7 @@ "File::Spec" : "0", "File::Temp" : "0", "FindBin" : "0", - "HTTP::Daemon" : "0", + "HTTP::Daemon" : "6.05", "HTTP::Response" : "0", "HTTP::Server::Simple::CGI" : "0", "LWP" : "0", diff --git a/Makefile.PL b/Makefile.PL index 2f0eb821..19101bf5 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -46,7 +46,7 @@ my %WriteMakefileArgs = ( "File::Spec" => 0, "File::Temp" => 0, "FindBin" => 0, - "HTTP::Daemon" => 0, + "HTTP::Daemon" => "6.05", "HTTP::Response" => 0, "HTTP::Server::Simple::CGI" => 0, "LWP" => 0, @@ -83,7 +83,7 @@ my %FallbackPrereqs = ( "HTML::TokeParser" => 0, "HTML::TreeBuilder" => 5, "HTTP::Cookies" => 0, - "HTTP::Daemon" => 0, + "HTTP::Daemon" => "6.05", "HTTP::Request" => "1.30", "HTTP::Request::Common" => 0, "HTTP::Response" => 0, diff --git a/cpanfile b/cpanfile index 0b715c02..182440cd 100644 --- a/cpanfile +++ b/cpanfile @@ -25,7 +25,7 @@ on 'test' => sub { requires "File::Spec" => "0"; requires "File::Temp" => "0"; requires "FindBin" => "0"; - requires "HTTP::Daemon" => "0"; + requires "HTTP::Daemon" => "6.05"; requires "HTTP::Response" => "0"; requires "HTTP::Server::Simple::CGI" => "0"; requires "LWP" => "0"; diff --git a/t/local/LocalServer.pm b/t/local/LocalServer.pm index c05baee0..f49c456b 100644 --- a/t/local/LocalServer.pm +++ b/t/local/LocalServer.pm @@ -113,11 +113,7 @@ sub spawn { die "Couldn't read back local server url" unless $url; - # What is this code supposed to fix? - my $lhurl = URI::URL->new( $url ); - $lhurl->host( '127.0.0.1' ); - $self->{_server_url} = $lhurl; - + $self->{_server_url} = URI::URL->new($url); $self->{_fh} = $server; $self->{_pid} = $pid; diff --git a/t/local/back.t b/t/local/back.t index 0ad2757b..b3b1641d 100644 --- a/t/local/back.t +++ b/t/local/back.t @@ -3,7 +3,7 @@ use strict; use Test::More tests => 47; use lib qw( t t/local ); use LocalServer; -use HTTP::Daemon; +use HTTP::Daemon 6.05; use HTTP::Response; diff --git a/t/local/log-server b/t/local/log-server index d43cb441..ca850036 100644 --- a/t/local/log-server +++ b/t/local/log-server @@ -1,8 +1,9 @@ # Thanks to merlyn for nudging me and giving me this snippet! use strict; -use HTTP::Daemon; +use HTTP::Daemon 6.05; use CGI 4.08; use Getopt::Long; +use Socket (); $|++; @@ -10,15 +11,16 @@ GetOptions( 'e=s' => \my $expression, ); -my $host = 'localhost'; -my $d = HTTP::Daemon->new( - LocalAddr => $host, -) or die; +my $d = HTTP::Daemon->new or die; -# HTTP::Deamon doesn't return http://localhost:.../ -# for LocalAddr => 'localhost'. This causes the -# tests to fail of many machines. -( my $url = URI->new($d->url) )->host($host); +my $url = URI->new($d->url); +if ($d->sockdomain == Socket::AF_INET) { + $url->host( '127.0.0.1' ); +} elsif ($d->sockdomain == Socket::AF_INET6) { + $url->host( '[::1]' ); +} else { + die "unexpected sockdomain: " . $d->sockdomain; +} print "$url\n"; my ($filename,$logfile) = @ARGV[0,1]; diff --git a/t/local/referer-server b/t/local/referer-server index 2c01bc06..7db693fb 100644 --- a/t/local/referer-server +++ b/t/local/referer-server @@ -1,13 +1,20 @@ # Thanks to merlyn for nudging me and giving me this snippet! -use HTTP::Daemon; +use HTTP::Daemon 6.05; use URI::URL; +use Socket (); $|++; my $d = HTTP::Daemon->new or die; my $lhurl = URI::URL->new( $d->url ); -$lhurl->host( "127.0.0.1" ); +if ($d->sockdomain == Socket::AF_INET) { + $lhurl->host( '127.0.0.1' ); +} elsif ($d->sockdomain == Socket::AF_INET6) { + $lhurl->host( '[::1]' ); +} else { + die "unexpected sockdomain: " . $d->sockdomain; +} print $lhurl->as_string, "\n"; $counter = 5; diff --git a/t/local/referer.t b/t/local/referer.t index ef5a7ce0..87dadaab 100644 --- a/t/local/referer.t +++ b/t/local/referer.t @@ -19,7 +19,7 @@ my $agent = WWW::Mechanize->new(); isa_ok( $agent, 'WWW::Mechanize' ); SKIP: { - eval { require HTTP::Daemon; }; + eval { require HTTP::Daemon; HTTP::Daemon->VERSION(6.05); }; skip 'HTTP::Daemon required to test the referrer header',10 if $@; # We want to be safe from non-resolving local host names