I sent an earlier message indicating that I was having trouble with failed HEAD requests that delegated down to Protocol/ftp.pm. My fix was to just make HEAD requests blindly discard any errors (by eval'ing the cleanup code) after successfully determining the file length.
In my particular application I know that I have the first START bytes,
I just don't know how long the rest of the file is, so I was calling
HEAD so I could add a header to the request like this:
$request->header( Range => { "bytes=$START-$END" } );
However, after poking around a bit I found a much better solution to
my problem. As documented here,
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35
a valid range request need not include an ending byte #. Thus I could
just say
$request->header( Range => { "bytes=$START-" } );
and be done with it.
However, the code that handles the Range header in LWP/Protocol/ftp.pm
can't handle this case -- it insists that the starting and ending byte
numbers both be defined.
I've attached a patch that fixes this particular case. The spec
defines some more variations on how the range header can be used, but
I don't know how many of them are workable or useful for ftp.
Thanks,
-Matthew
lwp_patch2.txt
Description: LWP/Protocol/ftp.pm patch for Range header
