Subject: | Bug in Net::SSL |
Date: | Fri, 13 Apr 2007 12:18:32 +0100 |
To: | <bug-Crypt-SSLeay [...] rt.cpan.org> |
From: | <ken.mclaren [...] bt.com> |
Greetings,
Many thanks for all the great work you guys do. It is most appreciated.
Anyway to cut to the chase, I have found a wee bug in the Net::SSL
package.
This might not interest you because the Net::SSL package is being used
directly i.e. not via LWP.
Anyway the bug occurs when you are using a proxy and you have a non
object subroutine on the stack which has a reference as its first
parameter.
The bug is in the get_lwp_object subroutine. I have included my current
fix, although I don't think this is general enough.
sub get_lwp_object {
my $self = shift;
my $lwp_object;
my $i = 0;
while(1) {
package DB;
my @stack = caller($i++);
last unless @stack;
my @stack_args = @DB::args;
my $stack_object = $stack_args[0] || next;
ref($stack_object) || next;
#
# This line of code has been added to stop the isa failing
#
ref($stack_object) ne 'HASH' || next;
if($stack_object->isa('LWP::UserAgent')) {
$lwp_object = $stack_object;
last;
}
}
$lwp_object;
}
In my case there is a non object subroutine call with a hash reference
as its first parameter on the stack. The current code assumes that any
reference as the first parameter points to a package, which is wrong in
this case. This results in the isa failing which results in the
connection failing.
I am using perl 5.8.8 on XP and Fedora Core 5.
Cheers,
Ken.