File tree 3 files changed +19
-14
lines changed 3 files changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -113,11 +113,7 @@ sub spawn {
113
113
die " Couldn't read back local server url"
114
114
unless $url ;
115
115
116
- # What is this code supposed to fix?
117
- my $lhurl = URI::URL-> new( $url );
118
- $lhurl -> host( ' localhost' );
119
- $self -> {_server_url } = $lhurl ;
120
-
116
+ $self -> {_server_url } = URI::URL-> new($url );
121
117
$self -> {_fh } = $server ;
122
118
$self -> {_pid } = $pid ;
123
119
Original file line number Diff line number Diff line change @@ -3,22 +3,24 @@ use strict;
3
3
use HTTP::Daemon 6.05;
4
4
use CGI 4.08;
5
5
use Getopt::Long;
6
+ use Socket ();
6
7
7
8
$|++;
8
9
9
10
GetOptions(
10
11
'e=s' => \my $expression,
11
12
);
12
13
13
- my $host = 'localhost';
14
- my $d = HTTP::Daemon->new(
15
- LocalAddr => $host,
16
- ) or die;
14
+ my $d = HTTP::Daemon->new or die;
17
15
18
- # HTTP::Deamon doesn't return http://localhost:.../
19
- # for LocalAddr => 'localhost'. This causes the
20
- # tests to fail of many machines.
21
- ( my $url = URI->new($d->url) )->host($host);
16
+ my $url = URI->new($d->url);
17
+ if ($d->sockdomain == Socket::AF_INET) {
18
+ $url->host( '127.0.0.1' );
19
+ } elsif ($d->sockdomain == Socket::AF_INET6) {
20
+ $url->host( '[::1]' );
21
+ } else {
22
+ die "unexpected sockdomain: " . $d->sockdomain;
23
+ }
22
24
print "$url\n";
23
25
24
26
my ($filename,$logfile) = @ARGV[0,1];
Original file line number Diff line number Diff line change 2
2
3
3
use HTTP::Daemon 6.05;
4
4
use URI::URL;
5
+ use Socket ();
5
6
6
7
$|++;
7
8
8
9
my $d = HTTP::Daemon->new or die;
9
10
my $lhurl = URI::URL->new( $d->url );
10
- $lhurl->host( 'localhost' );
11
+ if ($d->sockdomain == Socket::AF_INET) {
12
+ $lhurl->host( '127.0.0.1' );
13
+ } elsif ($d->sockdomain == Socket::AF_INET6) {
14
+ $lhurl->host( '[::1]' );
15
+ } else {
16
+ die "unexpected sockdomain: " . $d->sockdomain;
17
+ }
11
18
print $lhurl->as_string, "\n";
12
19
13
20
$counter = 5;
You can’t perform that action at this time.
0 commit comments