SSL read timeout

K

Kevin Collins

Hi,

I have a perl script running to query a SOAP process, but using a basic
Net::HTTPS connection. If the server takes more than 60 econds to respond, the
script fails with the following error:

SSL read timeout: at /opt/CTperl-5.8.4/lib/site_perl/5.8.4/Net/HTTP/Methods.pm
line 226 Net::SSL::die_with_error('Net::HTTPS=GLOB(0x60000000000608a0)', 'SSL
read timeout') called at
/opt/CTperl-5.8.4/lib/site_perl/5.8.4/IA64.ARCHREV_0-LP64/Net/SSL.pm line 218
....
....

My invocation looks like this:

my $connection = Net::HTTPS->new(Host => $Server, timeout => 300) || die $@;

Is there another means to set the SSL timeout? It would appear the 'timeout =>
300' is not affecting the SSL component.

Any help would be appreciated.

Thanks,

Kevin
 
C

C.DeRykus

Hi,

        I have a perl script running to query a SOAP process, butusing a basic
Net::HTTPS connection. If the server takes more than 60 econds to respond, the
script fails with the following error:

SSL read timeout:  at /opt/CTperl-5.8.4/lib/site_perl/5.8.4/Net/HTTP/Methods.pm
line 226 Net::SSL::die_with_error('Net::HTTPS=GLOB(0x60000000000608a0)', 'SSL
read timeout') called at
/opt/CTperl-5.8.4/lib/site_perl/5.8.4/IA64.ARCHREV_0-LP64/Net/SSL.pm line218
...
...

My invocation looks like this:

 my $connection = Net::HTTPS->new(Host => $Server, timeout => 300) || die $@;

Is there another means to set the SSL timeout? It would appear the 'timeout =>
300' is not affecting the SSL component.

Any help would be appreciated.

You could wrap the constructor call in a die/eval block.
See perldoc -f alarm

Note however that Perl's safe signal handling could cause
the alarm signal to be missed and the only workaround is
to use POSIX sigaction() and revert to unsafe signals.
See the "Interrupting IO" section in perlipc.
 
C

C.DeRykus

You could wrap the constructor call in a die/eval block.
See perldoc -f alarm

Note however that Perl's safe signal handling could cause
the alarm signal to be missed and the only workaround is
to use POSIX sigaction() and revert to unsafe signals.
See the "Interrupting IO" section in perlipc.

Actually, I forgot that you could fork off the connection call
in a child process and then set an alarm in the parent to wait
on the child's completion. This would avoid POSIX sigaction and
unsafe signals. If the connection child doesn't finish before the
alarm goes off, the parent just kills the child.
 
C

C.DeRykus

try using "Timeout" instead!

You're right. Net::HTTP/Net::HTTPS inherit from IO::Socket::INET
which specifies only an uppercase "Timeout" option.

perl -MNet::HTTPS -wle "$c=Net::HTTPS->new(Timeout=>10);
print $c->timeout"
10
 
K

Kevin Collins

You're right. Net::HTTP/Net::HTTPS inherit from IO::Socket::INET
which specifies only an uppercase "Timeout" option.

perl -MNet::HTTPS -wle "$c=Net::HTTPS->new(Timeout=>10);
print $c->timeout"
10

Thanks, guys! I had found Timeout, but tried to invoke it as:

$connection->Timeout(300);

but that did not work. I never thought to pass it as an option! That did the
trick...

Thanks,

Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top