Subject: | Cannot determine client ip-address when using ssl in net_server. |
Forwarding https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=775918:
Klaas Nijkes <klaas@nijkes.net> writes:
---
I use an overriden version of the module Net::Server::Fork as net_server.
This module uses the ssl-protocol in combination with IPv4.
In the function handle_request it is now not possible to determine the ip-address and tcp-port of the client.
This problem can be fixed with the following patch on /usr/share/perl5/HTTP/Server/Simple.pm:
@@ -386,6 +387,12 @@
my $remote_sockaddr = getpeername( $self->stdio_handle );
my ( $iport, $iaddr ) = $remote_sockaddr ? sockaddr_in($remote_sockaddr) : (undef,undef);
my $peeraddr = $iaddr ? ( inet_ntoa($iaddr) || "127.0.0.1" ) : '127.0.0.1';
+ my $server = shift;
+ if ($server && $server->{'server'}) {
+ $self->{'server'} = $server->{'server'};
+ $peeraddr = $self->{'server'}->{'peeraddr'} if ($self->{'server'}->{'peeraddr'});
+ $iport = $self->{'server'}->{'peerport'} if ($self->{'server'}->{'peerport'});
+ }
my ( $method, $request_uri, $proto ) = $self->parse_request;
The changes make it possible to use the peeraddr and peerport from
Net::Server, which are passed to the process_request function since version
2.000.
---
Although the code in question has been touched since 0.44, it looks like it would still suffer from the same issue.