Blame SOURCES/HTTP-Daemon-6.01-Handle-undef-and-empty-LocalAddr.patch

066508
From b54702ab21edbf1ea0dbc00d978aecc89e5764d6 Mon Sep 17 00:00:00 2001
066508
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
066508
Date: Mon, 18 Sep 2017 15:21:16 +0200
066508
Subject: [PATCH] Handle undef and empty LocalAddr
066508
MIME-Version: 1.0
066508
Content-Type: text/plain; charset=UTF-8
066508
Content-Transfer-Encoding: 8bit
066508
066508
IO::Socket::INET interprets undefined and empty string LocalAddr
066508
arguments as an unspecified address while IO::Socket::IP returns an
066508
error. This seems to be one of the differences between the two
066508
Socket implementations. Recent IO::Socket::IP (0.39) accepts undefined
066508
value, but still bail outs on an empty string.
066508
066508
To improve compatibility, this patch adds a special handling for these
066508
two values to be accepted as an unspecified value. Though this should
066508
be corrected on IO::Socket:IP side probably.
066508
066508
CPAN RT#91699
066508
CPAN RT#123069
066508
066508
Signed-off-by: Petr Písař <ppisar@redhat.com>
066508
---
066508
 lib/HTTP/Daemon.pm | 8 ++++++++
066508
 1 file changed, 8 insertions(+)
066508
066508
diff --git a/lib/HTTP/Daemon.pm b/lib/HTTP/Daemon.pm
066508
index 0e22b77..1e9d48e 100644
066508
--- a/lib/HTTP/Daemon.pm
066508
+++ b/lib/HTTP/Daemon.pm
066508
@@ -18,6 +18,14 @@ sub new
066508
     my($class, %args) = @_;
066508
     $args{Listen} ||= 5;
066508
     $args{Proto}  ||= 'tcp';
066508
+    # Handle undefined or empty local address the same way as
066508
+    # IO::Socket::INET -- use unspecified address
066508
+    for my $key (qw(LocalAddr LocalHost)) {
066508
+        if (exists $args{$key} &&
066508
+            (!defined($args{$key}) || $args{$key} eq '')) {
066508
+            delete $args{$key};
066508
+        }
066508
+    }
066508
     return $class->SUPER::new(%args);
066508
 }
066508
 
066508
-- 
066508
2.13.5
066508