Subject: | Timeouts do not work |
Timeouts do not appear to work in IO::Socket::SSL. Here's a short test script:
#!/usr/bin/perl -w
use strict;
use IO::Socket::SSL;
use LWP::UserAgent;
my $url = shift || 'https://cassia.dyn.rp.lan/cgi-bin/snooze.pl';
my $ua = LWP::UserAgent->new();
$ua->timeout( 15 );
my $resp = $ua->get( $url );
print $resp->as_string;
And here's the cgi script that it talks to:
#!/usr/bin/perl -w
use strict;
sleep 60;
print "Content-Type: text/plain\r\n\r\n";
print "Ok, I'm awake now.\n\n";
If I connect to the cgi script using ordinary http, it works ok:
% perl ~/foo.pl http://cassia.dyn.rp.lan/cgi-bin/snooze.pl
500 (Internal Server Error) read timeout
Client-Date: Fri, 05 Dec 2003 17:31:02 GMT
If I switch over to Crypt::SSLeay it works ok:
% perl ~/foo.pl https://cassia.dyn.rp.lan/cgi-bin/snooze.pl
500 (Internal Server Error) SSL read timeout:
Client-Date: Fri, 05 Dec 2003 17:31:56 GMT
However using IO::Socket::SSL, the script takes the full 60s and comes back with:
% perl ~/foo.pl https://cassia.dyn.rp.lan/cgi-bin/snooze.pl
HTTP/1.1 200 OK
Connection: close
Date: Fri, 05 Dec 2003 17:32:15 GMT
Server: Apache/1.3.28 (Unix) PHP/4.3.4 mod_perl/1.28 mod_ssl/2.8.15 OpenSSL/0.9.7a
Content-Type: text/plain
Client-Date: Fri, 05 Dec 2003 17:33:15 GMT
Client-Peer: 192.168.1.241:443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=XY/ST=Snake Desert/L=Snake Town/O=Snake Oil, Ltd/OU=Certificate Authority/CN=Snake Oil CA/Email=ca@snakeoil.dom
Client-SSL-Cert-Subject: /C=XY/ST=Snake Desert/L=Snake Town/O=Snake Oil, Ltd/OU=Webserver Team/CN=www.snakeoil.dom/Email=www@snakeoil.dom
Client-SSL-Cipher: EDH-RSA-DES-CBC3-SHA
Client-SSL-Warning: Peer certificate not verified
Client-Transfer-Encoding: chunked
Ok, I'm awake now.
Unfortunately, I can't tell how or why the timeout is not happening. Do you have any ideas?
Thanks,
-Dom