cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Resuming downloads; remote filesize

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 30 Aug 2001 08:23:55 +0200 (MET DST)

On Thu, 30 Aug 2001, Glenn McGrath wrote:

> Hi, im working on a mirroring program, im havign problems getting it to
> resume transfers.
>
> Obviously i only need to resume the transfer if the local filesize is
> smaller than the remote filesize, but how can i findout the remote
> filesize ?

You didn't mention what protocol you're referring to, but I figure that the
general approach you would want is to _not_ check the remote file size for
every file you're getting, as that would make a lot of extra checks all the
time.

You can get the file size with CURLOPT_NOBODY set, although for ftp you may
experience servers that don't support "SIZE" and for http you may find web
pages without any known size.

> From what i see of other programs they always set a resume point even if
> its resuming from 0, i tried doing that but got error messages saying the
> site doesnt support renge transfers, when clearly it does as curl can
> resume from transfers, any idea how this could happen.

I'm not sure I understand, can you show us a little example of what options
your using, what it reports back and possibly a verbose-dump?

> What should happen if i try and rsume from a point beyond the remote
> files length ?

For FTP, libcurl returns CURLE_FTP_BAD_DOWNLOAD_RESUME, for HTTP it is up to
the server, which I figure is guided by RFC2616.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2001-08-30