Skip Menu |
 

This queue is for tickets about the Crypt-SSLeay CPAN distribution.

Report information
The Basics
Id: 26401
Status: resolved
Priority: 0/
Queue: Crypt-SSLeay

People
Owner: dland [...] cpan.org
Requestors: pts [...] fazekas.hu
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.53
Fixed in: (no value)

Attachments


Subject: connect() never times out
Download (untitled) / with headers
text/plain 141b
Due to `sub Net::HTTPS::blocking {}' always returning false, the connect() in Net::SSL never times out. The attached patch fixes the problem.
Subject: pts-net-ssl-connect-blocking.patch
--- Net/SSL.pm.orig 2007-04-16 13:11:15.000000000 +0200 +++ Net/SSL.pm 2007-04-16 13:10:45.000000000 +0200 @@ -91,20 +91,21 @@ if ($self->proxy) { # don't die() in connect, just return undef and set $@ my $proxy_connect = eval { $self->proxy_connect_helper(@_); }; if(! $proxy_connect || $@) { $@ = "proxy connect failed: $@; $!"; die $@; } } else { *$self->{io_socket_peername}=@_ == 1 ? $_[0] : IO::Socket::sockaddr_in(@_); + local *Net::HTTPS::blocking; #### pts #### Dat: otherwise `sub Net::HTTPS::blocking { }' would prevent the proper timeout if(!$self->SUPER::connect(@_)) { # better to die than return here $@ = "Connect failed: $@; $!"; die $@; } } # print "ssl_version ".*$self->{ssl_version}."\n"; my $debug = *$self->{'ssl_debug'} || 0; my $ssl = Crypt::SSLeay::Conn->new(*$self->{'ssl_ctx'}, $debug, $self);
Download (untitled) / with headers
text/plain 326b
On Mon Apr 16 07:25:46 2007, PTS wrote: Show quoted text
> Due to `sub Net::HTTPS::blocking {}' always returning false, the > connect() in Net::SSL never times out. The attached patch fixes the
problem. Thanks for this patch, and sorry about taking so much time to respond. I have a couple of patches to roll into a new release. Later, David
From: dland [...] cpan.org
On Mon Apr 16 07:25:46 2007, PTS wrote: Show quoted text
> Due to `sub Net::HTTPS::blocking {}' always returning false, the > connect() in Net::SSL never times out. The attached patch fixes the
problem. I've had the time to analyse this patch and I have a couple of issues with it. Firstly, in the Net::HTTPS module, the following comment appears: # The underlying SSLeay classes fails to work if the socket is # placed in non-blocking mode. This override of the blocking # method makes sure it stays the way it was created. Now I'm not sure whether this is for historical purposes, given that most people these days are using OpenSSL libraries. So I'm not sure it's wise to short-circuit the current provisions for not permitting non-blocking sockets. Be that as it may, as you point out the need to be able to do just this, I think a better idea is to expose the underlying IO::Socket::INET::blocking setting through the Net::SSL interface, and thus let client code reconfigure the blocking setting as they see fit. How does this sound to you? Regards, David Landgren
Download (untitled) / with headers
text/plain 276b
I have uploaded version 0.55, which adds a blocking() method. This should let you do what you want. I'm therefore closing this bug, since I haven't heard back from you regarding the approach. Feel free to reply if there's something else that needs to be done. Regards, David
From: pts [...] fazekas.hu
Download (untitled) / with headers
text/plain 183b
Sorry for not replying earlier. The project for which we needed HTTPS connect() with timeout is over now. If we experience any further problems, I'll let you know. Best regards, PTS


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.