#!perl
use strict;
no strict 'refs';
use LWP::UserAgent;
use Net::HTTPS;
warn "Net::HTTPS::SSL_SOCKET_CLASS=$Net::HTTPS::SSL_SOCKET_CLASS Version " . ${$Net::HTTPS::SSL_SOCKET_CLASS . "::VERSION"} . "\n";
#use Sub::Delete;delete_sub 'Net::HTTPS::blocking'; # <-- toggle this line
my $ua = LWP::UserAgent->new;
$ua->timeout(1);
my $resp = $ua->get("
https://www.example.com");
warn $resp->as_string;
__END__
=pod
Summary
| SSL Socket class | with blocking() | blocking() deleted |
|----------------------+-----------------+--------------------|
| IO::Socket::SSL 1.02 | 189s | ~1s |
| IO::Socket::SSL 1.22 | 189s | 1.148s |
| Net::SSL 2.84 | 189s | 1.142s |
With Net::HTTPS::blocking deleted and no Crypt::SSLeay installed:
(answer after about one second):
Net::HTTPS::SSL_SOCKET_CLASS=IO::Socket::SSL Version 1.02
500 Can't connect to www.example.com:443 (connect: timeout)
Content-Type: text/plain
Client-Date: Tue, 10 Feb 2009 10:03:08 GMT
Client-Warning: Internal response
500 Can't connect to www.example.com:443 (connect: timeout)
With Net::HTTPS::blocking not deleted:
Net::HTTPS::SSL_SOCKET_CLASS=IO::Socket::SSL Version 1.02
500 Can't connect to www.example.com:443 (connect: Connection timed out)
Content-Type: text/plain
Client-Date: Tue, 10 Feb 2009 10:07:06 GMT
Client-Warning: Internal response
500 Can't connect to www.example.com:443 (connect: Connection timed out)
perl /tmp/lwp.pl 0,14s user 0,01s system 0% cpu 3:09,15 total
Upgrade to IO::Socket::SSL 1.22, ::blocking deleted:
Net::HTTPS::SSL_SOCKET_CLASS=IO::Socket::SSL Version 1.22
500 Can't connect to www.example.com:443 (connect: timeout)
Content-Type: text/plain
Client-Date: Tue, 10 Feb 2009 10:09:17 GMT
Client-Warning: Internal response
500 Can't connect to www.example.com:443 (connect: timeout)
perl /tmp/lwp.pl 0,13s user 0,02s system 12% cpu 1,148 total
IO::Socket::SSL 1.22, ::blocking not deleted:
Net::HTTPS::SSL_SOCKET_CLASS=IO::Socket::SSL Version 1.22
500 Can't connect to www.example.com:443 (connect: Connection timed out)
Content-Type: text/plain
Client-Date: Tue, 10 Feb 2009 10:12:47 GMT
Client-Warning: Internal response
500 Can't connect to www.example.com:443 (connect: Connection timed out)
perl /tmp/lwp.pl 0,13s user 0,02s system 0% cpu 3:09,16 total
Crypt-SSLeay-0.57 installed, ::blocking deleted:
Net::HTTPS::SSL_SOCKET_CLASS=Net::SSL Version 2.84
500 Connect failed: connect: timeout; Loš opisnik datoteke
Content-Type: text/plain
Client-Date: Tue, 10 Feb 2009 10:34:07 GMT
Client-Warning: Internal response
500 Connect failed: connect: timeout; Loš opisnik datoteke
perl /tmp/lwp.pl 0,11s user 0,01s system 10% cpu 1,142 total
Crypt-SSLeay-0.57 installed, ::blocking not deleted:
Net::HTTPS::SSL_SOCKET_CLASS=Net::SSL Version 2.84
500 Connect failed: connect: Connection timed out; Connection timed out
Content-Type: text/plain
Client-Date: Tue, 10 Feb 2009 10:37:32 GMT
Client-Warning: Internal response
500 Connect failed: connect: Connection timed out; Connection timed out
perl /tmp/lwp.pl 0,10s user 0,02s system 0% cpu 3:09,13 total
=cut