From: Kevin Collins on
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
From: C.DeRykus on
On Feb 1, 1:47 pm, Kevin Collins <spamtotr...(a)toomuchfiction.com>
wrote:
> 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.
>

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.

--
Charles DeRykus
From: C.DeRykus on
On Feb 1, 5:38 pm, "C.DeRykus" <dery...(a)gmail.com> wrote:
> On Feb 1, 1:47 pm, Kevin Collins <spamtotr...(a)toomuchfiction.com>
> wrote:
>
>
>
> > 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.
>
> 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.


--
Charles DeRykus

From: Salvador Fandino on
C.DeRykus wrote:
> On Feb 1, 1:47 pm, Kevin Collins <spamtotr...(a)toomuchfiction.com>
> wrote:
>> 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 $@;

try using "Timeout" instead!

- Salva
From: C.DeRykus on
On Feb 2, 2:26 am, Salvador Fandino <sfand...(a)yahoo.com> wrote:
> C.DeRykus wrote:
> > On Feb 1, 1:47 pm, Kevin Collins <spamtotr...(a)toomuchfiction.com>
> > wrote:
> >> 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 $@;
>
> 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

--
Charles DeRykus