IO::Socket::SSL: cannot connect using different LocalAddr
am 02.10.2007 18:28:59 von plbl4sterI'm trying to connect to HTTPS server using local address other than
the default (the machine I'm using has more IP addresses assigned). I
wrote something like this:
$socket = new IO::Socket::SSL(PeerAddr => "foo", PeerPort => 443,
Proto => "tcp", LocalAddr => "1.2.3.4");
but it hangs and doesn't create a socket. This one:
$socket = new IO::Socket::INET(PeerAddr => "foo", PeerPort => 443,
Proto => "tcp", LocalAddr => "1.2.3.4");
IO::Socket::SSL->start_SSL($socket);
creates a socket, but blocks at start_SSL. When I set SSL version to
2, it succeeds:
$socket = new IO::Socket::SSL(PeerAddr => "foo", PeerPort => 443,
Proto => "tcp", LocalAddr => "1.2.3.4", SSL_version => "SSLv2");
print $socket "GET / HTTP/1.0\nHost: foo\n\n";
$line = <$socket>;
However, when I change the request URL, it blocks at first read:
$socket = new IO::Socket::SSL(PeerAddr => "foo", PeerPort => 443,
Proto => "tcp", LocalAddr => "1.2.3.4", SSL_version => "SSLv2");
print $socket "GET /account/ HTTP/1.0\nHost: foo\n\n";
$line = <$socket>;
Everything works fine after removing LocalAddr parameter or setting it
to my default IP address. When I set $IO::Socket::SSL::DEBUG to 4,
only one message is displayed:
CA file certs/my-ca.pem not found, using CA path instead.
But it's always displayed, whether I specify LocalAddr or not. Does
anyone know how to fix this problem?
bl4