A failing reverse lookup doesn't imply it's a local address
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine / HTTP.pm
index 30ddbc4..1ba4cf2 100644 (file)
@@ -68,7 +68,8 @@ sub finalize_headers {
 
     # Should we keep the connection open?
     my $connection = $c->request->header('Connection');
-    if (   $self->options->{keepalive}
+    if (   $self->options
+        && $self->options->{keepalive}
         && $connection
         && $connection =~ /^keep-alive$/i
     ) {
@@ -545,7 +546,7 @@ sub _socket_data {
     my %hostname_cache;
     sub _gethostbyaddr {
         my $ip = shift;
-        $hostname_cache{$ip} ||= gethostbyaddr( $ip, AF_INET ) || 'localhost';
+        $hostname_cache{$ip} ||= gethostbyaddr( $ip, AF_INET ) || $ip;
     }
 }