Accept undefined and empty-string LocalAddr as IO::Socket::INET does
This commit is contained in:
parent
3ea8c1eac2
commit
cbe31ddea2
48
HTTP-Daemon-6.01-Handle-undef-and-empty-LocalAddr.patch
Normal file
48
HTTP-Daemon-6.01-Handle-undef-and-empty-LocalAddr.patch
Normal file
@ -0,0 +1,48 @@
|
||||
From 607e0fa0787d12cd9f1545a9d26edb30f42201cc Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
||||
Date: Mon, 18 Sep 2017 15:21:16 +0200
|
||||
Subject: [PATCH] Handle undef and empty LocalAddr
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
IO::Socket::INET interprets undefined and empty string LocalAddr
|
||||
arguments as an unspecified address while IO::Socket::IP returns an
|
||||
error. This seems to be one of the differences between the two
|
||||
Socket implementations. Recent IO::Socket::IP (0.39) accepts undefined
|
||||
value, but still bail outs on an empty string.
|
||||
|
||||
To improve compatibility, this patch adds a special handling for these
|
||||
two values to be accepted as an unspecified value. Though this should
|
||||
be corrected on IO::Socket:IP side probably.
|
||||
|
||||
CPAN RT#91699
|
||||
CPAN RT#123069
|
||||
|
||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||
---
|
||||
lib/HTTP/Daemon.pm | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/lib/HTTP/Daemon.pm b/lib/HTTP/Daemon.pm
|
||||
index 0e22b77..be5cdec 100644
|
||||
--- a/lib/HTTP/Daemon.pm
|
||||
+++ b/lib/HTTP/Daemon.pm
|
||||
@@ -18,6 +18,14 @@ sub new
|
||||
my($class, %args) = @_;
|
||||
$args{Listen} ||= 5;
|
||||
$args{Proto} ||= 'tcp';
|
||||
+ # Handle undefined or empty local address the same way as
|
||||
+ # IO::Socket::INET -- use unspecified address
|
||||
+ for my $key (qw(LocalAddr LocalHost)) {
|
||||
+ if (exists $args{$key} &&
|
||||
+ (!defined($args{$key}) || $args{LocalAddr} eq '')) {
|
||||
+ delete $args{$key};
|
||||
+ }
|
||||
+ }
|
||||
return $class->SUPER::new(%args);
|
||||
}
|
||||
|
||||
--
|
||||
2.13.5
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: perl-HTTP-Daemon
|
||||
Version: 6.01
|
||||
Release: 17%{?dist}
|
||||
Release: 18%{?dist}
|
||||
Summary: Simple HTTP server class
|
||||
License: GPL+ or Artistic
|
||||
Group: Development/Libraries
|
||||
@ -9,6 +9,9 @@ Source0: http://www.cpan.org/authors/id/G/GA/GAAS/HTTP-Daemon-%{version}.
|
||||
# Support IPv6, bug #1413065, CPAN RT#91699, CPAN RT#71395,
|
||||
# proposed to upstream
|
||||
Patch0: HTTP-Daemon-6.01-Add-IPv6-support.patch
|
||||
# Accept undefined and empty-string LocalAddr as IO::Socket::INET does,
|
||||
# CPAN RT#91699, CPAN RT#123069
|
||||
Patch1: HTTP-Daemon-6.01-Handle-undef-and-empty-LocalAddr.patch
|
||||
BuildArch: noarch
|
||||
BuildRequires: findutils
|
||||
BuildRequires: make
|
||||
@ -57,6 +60,7 @@ IO::Socket::INET, so you can perform socket operations directly on it too.
|
||||
%prep
|
||||
%setup -q -n HTTP-Daemon-%{version}
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
|
||||
%build
|
||||
perl Makefile.PL INSTALLDIRS=vendor
|
||||
@ -76,6 +80,10 @@ make test
|
||||
%{_mandir}/man3/*
|
||||
|
||||
%changelog
|
||||
* Mon Sep 18 2017 Petr Pisar <ppisar@redhat.com> - 6.01-18
|
||||
- Accept undefined and empty-string LocalAddr as IO::Socket::INET does
|
||||
(bug #1413065)
|
||||
|
||||
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 6.01-17
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user