LWP::Protocol::http bug with SSL returning 500 Can't read entity body
"Wilson Snyder" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.lwp |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I'm using libwww-perl-5.805.tar.gz.
Running code like this to get a page:
use WWW::Mechanize;
our $Mech = WWW::Mechanize->new();
#$Mech->get("https://library.minlib.net:443/patroninfo/");
Returns a "500 Can't read entity body: " error.
This is because the read_entity_body loop can't cope with a multi sysread
where the last packet returned is the EOF alone.
It's the first time I've poked in this code, so this may be off, but one
possible patch that fixes it is below. This is for
# $Id: http.pm,v 1.70 2005/12/08 10:28:01 gisle Exp $
Thanks for the great package.
*** /usr/lib/perl5/site_perl/5.8.6/LWP/Protocol/http.pm.old 2006-03-05 21:14:32.000000000 -0500
--- /usr/lib/perl5/site_perl/5.8.6/LWP/Protocol/http.pm 2006-03-05 21:04:35.000000000 -0500
***************
*** 338,349 ****
--- 338,352 ----
$response->push_header('Client-Response-Num', $socket->increment_response_count);
my $complete;
+ my $gotone;
$response = $self->collect($arg, $response, sub {
my $buf = ""; #prevent use of uninitialized value in SSLeay.xs
my $n;
READ:
{
$n = $socket->read_entity_body($buf, $size);
+ $gotone = 1 if defined $n;
+ $n=0 if !defined $n && $gotone;
die "Can't read entity body: $!" unless defined $n;
redo READ if $n == -1;
}