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

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