Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: x00000000 [...] freenet.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 5.805
Fixed in: (no value)



Subject: FTP range request size off by one in LWP::Protocol::ftp
The size calculation for FTP range requests is off by one. The 2nd number in the HTTP Request header is the index of the last byte requested, not the index of the first byte not requested. Thus, in LWP/Protocol/ftp.pm $max_size = $end_byte - $start_byte; should be $max_size = $end_byte - $start_byte + 1; Compare: perl -lMLWP::UserAgent '-eprint LWP::UserAgent->new()->get("http://cpan.org/src/README",Range=>"bytes=0-3")->content' perl -lMLWP::UserAgent '-eprint LWP::UserAgent->new()->get("ftp://cpan.org/src/README",Range=>"bytes=0-3")->content'
Since the FTP site in the example provided has gone away, here's another set of examples: perl -MLWP::UserAgent -E 'say LWP::UserAgent->new()->get("http://ftp.usf.edu/pub/centos/TIME",Range=>"bytes=0-3")->content' 1485 perl -MLWP::UserAgent -E 'say LWP::UserAgent->new()->get("ftp://ftp.usf.edu/pub/centos/TIME",Range=>"bytes=0-3")->content' 148