[Catalyst] Testserver dies under IE - patch

Jesper Krogh jesper at krogh.cc
Tue Oct 3 12:04:15 CEST 2006


> Hi all.
>
>
> This is a small patch that makes the testserver survive Internet
> Explorer..

This one even works..

--- /usr/share/perl5/Catalyst/Engine/HTTP.pm    2006-07-19
23:45:16.000000000 +0200
+++ lib/Catalyst/Engine/HTTP.pm 2006-10-03 12:02:25.000000000 +0200
@@ -305,13 +305,14 @@
     my ( $self, $handle ) = @_;

     my $remote_sockaddr = getpeername($handle);
-    my ( undef, $iaddr ) = sockaddr_in($remote_sockaddr);
+    my $iaddr;
+    ( undef, $iaddr ) = sockaddr_in($remote_sockaddr) if $remote_sockaddr;
     my $local_sockaddr = getsockname($handle);
     my ( undef, $localiaddr ) = sockaddr_in($local_sockaddr);

     my $data = {
-        peername => gethostbyaddr( $iaddr, AF_INET ) || "localhost",
-        peeraddr => inet_ntoa($iaddr) || "127.0.0.1",
+       peername => $iaddr ? gethostbyaddr( $iaddr, AF_INET ) :
"localhost/Unknown",
+       peeraddr => $iaddr ? inet_ntoa($iaddr) : "127.0.0.1/Unknown",
         localname => gethostbyaddr( $localiaddr, AF_INET ) || "localhost",
         localaddr => inet_ntoa($localiaddr) || "127.0.0.1",
     };


Jesper
-- 
Jesper Krogh




More information about the Catalyst mailing list