Click here to get back home

IO::Socket::SSL: cannot connect using different LocalAddr

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
IO::Socket::SSL: cannot connect using different LocalAddr plbl4ster 10-02-2007
Posted by plbl4ster on October 2, 2007, 12:28 pm
Please log in for more thread options
I'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


Similar ThreadsPosted
IO::Socket::SSL March 24, 2005, 10:10 pm
LWP and socket May 1, 2007, 6:06 pm
IO::Socket sometimes hang, why? Please help November 7, 2004, 7:54 pm
IO::Socket->socketpair() May 21, 2007, 3:25 pm
Installing IO::Socket::SSL on Win32? June 30, 2006, 11:11 am
IO::Socket default timeout September 25, 2006, 2:35 pm
Credentials and POST method with IO::Socket::SSL? June 30, 2006, 5:14 pm
IO::Socket::INET nonblocking confusing April 25, 2007, 7:27 am
SSLeay & OpenSSL problem with install of IO::Socket::SSL June 24, 2005, 9:39 am
IPV6 socket connection, with a link-local address January 11, 2008, 1:12 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap