Skip Menu |

This queue is for tickets about the libwww-perl CPAN distribution.

Report information
The Basics
Id: 35090
Status: resolved
Priority: 0/
Queue: libwww-perl

People
Owner: Nobody in particular
Requestors: dmuey [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 5.811
Fixed in: (no value)



Subject: 5.811 breaks SSL requests
All SSL requests (except ones that '500 Server closed connection without sending any data back' first) fail with: 500 read failed: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number I'm looking over the 5.810 -> 5.811 patch and stracing the request to see why that's happening.
Definitely the error thrown in Net::SSL's read(), specifically: $self->die_with_error("read failed") if !defined $n;
On Tue Apr 15 17:26:02 2008, DMUEY wrote: Show quoted text
> Definitely the error thrown in Net::SSL's read(), specifically: > > $self->die_with_error("read failed") if !defined $n;
so somehow LWP prepends status number '500' LWP 'argument': Crypt::SSLeay::Err::get_error_string() --- --------: ---------------------------- 500 read failed: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number
Reversing this part of the lib/LWP/Protocol/http.pm patch lets it work: http://search.cpan.org/diff?from=libwww-perl-5.810&to=libwww-perl- 5.811&w=1#lib/LWP/Protocol/http.pm - # XXX need to watch out for write timeouts - my $n = $socket->syswrite($req_buf, length($req_buf)); - die $! unless defined($n); - die "short write" unless $n == length($req_buf); - #LWP::Debug::conns($req_buf); - $req_buf = ""; + do { + # Since this just writes out the header block it should almost + # always succeed to send the whole buffer in a single write call. + my $n = syswrite($socket, $req_buf, length($req_buf)); + unless (defined $n) { + redo if $!{EINTR}; + if ($!{EAGAIN}) { + select(undef, undef, undef, 0.1); + redo; + } + die "write failed: $!"; + } + if ($n) { + substr($req_buf, 0, $n, ""); + } + else { + select(undef, undef, undef, 0.5); + } + } + while (length $req_buf); }
On Tue Apr 15 17:46:14 2008, DMUEY wrote: Show quoted text
> Reversing this part of the lib/LWP/Protocol/http.pm patch lets it > work:
I don't see how that can be. Do you understand what happens?
I see. It's the fact that we don't call syswrite() as a method any more. Stupid me.
Show quoted text
> I don't see how that can be. Do you understand what happens?
It's obscure thats for sure :) Show quoted text
> I see. It's the fact that we don't call syswrite() as a method any > more. Stupid me.
I'd tried changing just that call but it didn't fix it for me. Show quoted text
> Fixed, and LWP-5.812 uploaded to CPAN. > > http://gitorious.org/projects/libwww- > perl/repos/mainline/commits/32a0ebd4d0f018f3d35f77a7259260718046aa75
Excellent, I'll give it a shot, thanks for your time
Verified fixed: multivac:~ dmuey$ perl -le 'use LWP;print $LWP::VERSION;' 5.811 multivac:~ dmuey$ GET https://www.google.com/ 500 read test failed: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number multivac:~ dmuey$ sudo cpan LWP ... multivac:~ dmuey$ perl -le 'use LWP;print $LWP::VERSION;' 5.812 multivac:~ dmuey$# GET https://www.google.com/ <html>... thanks!