1From 2d7a479b39bb20a0d61f067ba6c2df92117fcb8c Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
3Date: Wed, 23 Apr 2014 12:45:38 +0200
4Subject: [PATCH] Connect to localhost instead of hostname
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9The hostname does not have to be resolvable nor reachable. It's just
10a machine name.
11
12Signed-off-by: Petr Písař <ppisar@redhat.com>
13---
14 t/local/http.t | 2 +-
15 t/robot/ua-get.t | 2 +-
16 t/robot/ua.t | 2 +-
17 talk-to-ourself | 3 +--
18 4 files changed, 4 insertions(+), 5 deletions(-)
19
20diff --git a/t/local/http.t b/t/local/http.t
21index 779cc21..534b4c8 100644
22--- a/t/local/http.t
23+++ b/t/local/http.t
24@@ -20,7 +20,7 @@ if ($D eq 'daemon') {
25
26 require HTTP::Daemon;
27
28- my $d = HTTP::Daemon->new(Timeout => 10);
29+ my $d = HTTP::Daemon->new(Timeout => 10, LocalAddr => 'localhost');
30
31 print "Please to meet you at: <URL:", $d->url, ">\n";
32 open(STDOUT, $^O eq 'VMS'? ">nl: " : ">/dev/null");
33diff --git a/t/robot/ua-get.t b/t/robot/ua-get.t
34index 5754c4b..bf24589 100644
35--- a/t/robot/ua-get.t
36+++ b/t/robot/ua-get.t
37@@ -19,7 +19,7 @@ if ($D eq 'daemon') {
38
39 require HTTP::Daemon;
40
41- my $d = new HTTP::Daemon Timeout => 10;
42+ my $d = new HTTP::Daemon Timeout => 10, LocalAddr => 'localhost';
43
44 print "Please to meet you at: <URL:", $d->url, ">\n";
45 open(STDOUT, $^O eq 'MSWin32' ? ">nul" : $^O eq 'VMS' ? ">NL:" : ">/dev/null");
46diff --git a/t/robot/ua.t b/t/robot/ua.t
47index 21ad5c8..11fafa8 100644
48--- a/t/robot/ua.t
49+++ b/t/robot/ua.t
50@@ -19,7 +19,7 @@ if ($D eq 'daemon') {
51
52 require HTTP::Daemon;
53
54- my $d = new HTTP::Daemon Timeout => 10;
55+ my $d = new HTTP::Daemon Timeout => 10, LocalAddr => 'localhost';
56
57 print "Please to meet you at: <URL:", $d->url, ">\n";
58 open(STDOUT, $^O eq 'MSWin32' ? ">nul" : $^O eq 'VMS' ? ">NL:" : ">/dev/null");
59diff --git a/talk-to-ourself b/talk-to-ourself
60index 6c0257a..b4acda2 100644
61--- a/talk-to-ourself
62+++ b/talk-to-ourself
63@@ -9,8 +9,7 @@ require IO::Socket;
64
65 if (@ARGV >= 2 && $ARGV[0] eq "--port") {
66 my $port = $ARGV[1];
67- require Sys::Hostname;
68- my $host = Sys::Hostname::hostname();
69+ my $host = 'localhost';
70 if (my $socket = IO::Socket::INET->new(PeerAddr => "$host:$port", Timeout => 5)) {
71 require IO::Select;
72 if (IO::Select->new($socket)->can_read(1)) {
73--
741.9.0
75