[Bps-public-commit] HTTP-Server-Simple branch, master, updated. 0.45_03-5-g89fc697
Kevin Falcone
falcone at bestpractical.com
Thu Jan 22 10:13:42 EST 2015
The branch, master has been updated
via 89fc697bae2c4d710618abc0f84a56cccfb50b84 (commit)
via d3fbf8f5fc160eac291a8c01d3ba6cc3916e9959 (commit)
via 415ca2f4890e964025ec7ac50a968951e649fbe5 (commit)
via bc29bf07110a5a805743e65f6c59ee5e30b1d43b (commit)
via 1b33ef17bf324512b3e05107384fd3d47e3d3614 (commit)
from d6855687da3e991201d19699caf76ba702aac440 (commit)
Summary of changes:
Changes | 4 ++++
META.yml | 4 ++--
Makefile.PL | 2 +-
lib/HTTP/Server/Simple.pm | 22 +++++++++++++++-------
t/01live.t | 2 ++
5 files changed, 24 insertions(+), 10 deletions(-)
- Log -----------------------------------------------------------------
commit 1b33ef17bf324512b3e05107384fd3d47e3d3614
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Tue Jan 20 17:14:28 2015 -0500
Require Socket 1.94
In ac4b90f4 we started using Socket::IN6ADDR_ANY and friends, but Socket
before 1.94 didn't have IPv6 infrastructure. This means any stock perl
older than 5.13.10 would explode running this code. However, Socket is
dual-lifed so we can require a newer socket on 5.8 through 5.12. Newer
perls will already have a new Socket.
diff --git a/META.yml b/META.yml
index 966af0e..cbb2116 100644
--- a/META.yml
+++ b/META.yml
@@ -21,7 +21,7 @@ no_index:
- t
requires:
CGI: 0
- Socket: 0
+ Socket: 1.94
Test::More: 0
resources:
license: http://dev.perl.org/licenses/
diff --git a/Makefile.PL b/Makefile.PL
index 93b7b53..566eb55 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -4,7 +4,7 @@ all_from('lib/HTTP/Server/Simple.pm');
name('HTTP-Server-Simple');
license('perl');
requires(
- Socket => 0,
+ Socket => 1.94,
'Test::More' => 0,
CGI => 0,
);
commit bc29bf07110a5a805743e65f6c59ee5e30b1d43b
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Tue Jan 20 17:16:27 2015 -0500
Switch to using getnameinfo
inet_ntop isn't implemented by Strawberry Perl, so ac4b90f4
broke windows in addition to perls older than 5.14 (fixed by previous
commit).
https://rt.cpan.org/Public/Bug/Display.html?id=84600
Since we're now requiring Socket 1.94 we can use getnameinfo() which is
documented as "preferred" to inet_ntop and gethostbyaddr.
Since we're not requiring 1.96, we just throw away the service name
rather than disabling it with NIx_NOSERV, we'll see if that causes
problems.
diff --git a/lib/HTTP/Server/Simple.pm b/lib/HTTP/Server/Simple.pm
index 17ff076..e95d90c 100644
--- a/lib/HTTP/Server/Simple.pm
+++ b/lib/HTTP/Server/Simple.pm
@@ -163,12 +163,14 @@ sub lookup_localhost {
my $local_sockaddr = getsockname( $self->stdio_handle );
my $local_family = sockaddr_family($local_sockaddr);
- my ( undef, $localiaddr ) =
- ($local_family == AF_INET6) ? sockaddr_in6($local_sockaddr)
- : sockaddr_in($local_sockaddr);
- $self->host( gethostbyaddr( $localiaddr, $local_family ) || "localhost");
- $self->{'local_addr'} = Socket::inet_ntop($local_family, $localiaddr)
+ my ($host_err,$local_host, undef) = Socket::getnameinfo($local_sockaddr,0);
+ warn $host_err if ($host_err);
+ $self->host( $local_host || "localhost");
+
+ my ($addr_err,$local_addr,undef) = Socket::getnameinfo($local_sockaddr,Socket::NI_NUMERICHOST);
+ warn $addr_err if ($addr_err);
+ $self->{'local_addr'} = $local_addr
|| (($local_family == AF_INET6) ? "::1" : "127.0.0.1");
}
@@ -400,7 +402,13 @@ sub _process_request {
: (undef,undef);
my $loopback = ($family == AF_INET6) ? "::1" : "127.0.0.1";
- my $peeraddr = $iaddr ? ( Socket::inet_ntop($family, $iaddr) || $loopback ) : $loopback;
+ my $peeraddr = $loopback;
+ if ($iaddr) {
+ my ($host_err,$addr, undef) = Socket::getnameinfo($remote_sockaddr,Socket::NI_NUMERICHOST);
+ warn ($host_err) if $host_err;
+ $peeraddr = $addr || $loopback;
+ }
+
my ( $method, $request_uri, $proto ) = $self->parse_request;
commit 415ca2f4890e964025ec7ac50a968951e649fbe5
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Tue Jan 20 17:37:28 2015 -0500
Be explicit about binding to localhost.
The fetch sub is going to request localhost:$PORT, but we were asking
for *:$PORT which was failing on a lot of test systems. We still need
to rethink the logic of "picking a $PORT and praying" but that's a
larger change.
diff --git a/t/01live.t b/t/01live.t
index cd58b98..c0c2c2c 100644
--- a/t/01live.t
+++ b/t/01live.t
@@ -131,6 +131,8 @@ sub run_server_tests {
is($s->family(), $fam, 'constructor set family properly');
is($s->port(),$PORT,"Constructor set port correctly");
+ $s->host('localhost'); # otherwise we bind to * which doesn't work on all systems
+
my $pid=$s->background();
select(undef,undef,undef,0.2); # wait a sec
commit d3fbf8f5fc160eac291a8c01d3ba6cc3916e9959
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Tue Jan 20 17:40:57 2015 -0500
Release 0.45_04
diff --git a/Changes b/Changes
index 60b52f4..d7eb965 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,7 @@
+0.45_04
+* Fix compatibility for the IPv5 support in .45_02
+* Hopefully improve the live tests
+
0.45_03
* Remove useless VERSION from HTTP::Server::Simple::CGI and HTTP::Server::Simple::CGI::Environment
diff --git a/META.yml b/META.yml
index cbb2116..2a185d8 100644
--- a/META.yml
+++ b/META.yml
@@ -25,4 +25,4 @@ requires:
Test::More: 0
resources:
license: http://dev.perl.org/licenses/
-version: 0.45_03
+version: 0.45_04
diff --git a/lib/HTTP/Server/Simple.pm b/lib/HTTP/Server/Simple.pm
index e95d90c..479279b 100644
--- a/lib/HTTP/Server/Simple.pm
+++ b/lib/HTTP/Server/Simple.pm
@@ -7,7 +7,7 @@ use Socket;
use Carp;
use vars qw($VERSION $bad_request_doc);
-$VERSION = '0.45_03';
+$VERSION = '0.45_04';
=head1 NAME
commit 89fc697bae2c4d710618abc0f84a56cccfb50b84
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Tue Jan 20 17:54:56 2015 -0500
I hesitate to think what IPv5 would look like
diff --git a/Changes b/Changes
index d7eb965..e4c088c 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,5 @@
0.45_04
-* Fix compatibility for the IPv5 support in .45_02
+* Fix compatibility for the IPv6 support in .45_02
* Hopefully improve the live tests
0.45_03
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list