curl-library
Re: SFTP and CURLOPT_RANGE
Date: Fri, 12 Sep 2008 14:48:29 -0400
Ian Lynagh wrote:
> Hi Wei,
>
> On Fri, Sep 12, 2008 at 12:40:30AM -0400, Wei Weng wrote:
>> Ian Lynagh wrote:
>>> half way there. Unfortunately, due to unfamiliarity with the code, I
>>> haven't managed the other half yet, and I don't have any more time to work on
>>> this at the moment. Presumably all that is needed is to tell curl how
>>> many bytes to download, somehow. I'd be delighted if someone was able to
>>> finish this off, or give me some clues on how to do so myself.
>> Can not you use SSH_FXP_STAT to get the file size?
>> (http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.5)
>>
>> And then deduct the range from the size to get the length you wanna
>> download/upload from the file.
>
> My problem is not how to find the file size, but how to tell curl/libssh
> how many bytes to download.
>
> For example, if the range is "34384-34394" then I know how to say "start
> at 34384", but not "get 11 bytes" (or equivalently, "stop at 34394").
>
>
> Thanks
> Ian
>
>
Ian,
Have you looked at this variable?
struct SingleRequest {
...
curl_off_t maxdownload; /* in bytes, the maximum amount of data to fetch,
-1 means unlimited */
...
};
It is in lib/urldata.h
The way to use it you can refer to ftp_range function in ftp.c.
Thanks
Wei
Received on 2008-09-12