FTP and HTTP resume?

David Bovill david at openpartnership.net
Wed Jul 11 08:35:23 CDT 2007

On 11/07/07, Dave Cragg <dave.cragg at lacscentre.co.uk> wrote:

For resuming http downloads, take a look at using the Range header in
> the httpHeaders. It would look something like this (untried):
>    set the httpHeaders to "Range: bytes=1000-1999"

This seems the best option... so I'd need to know how many bites I had
downloaded... if I use:

      libURLDownloadToFile downloadURL, filePath, "http_DownloadComplete"

Then after stopping I would need to work out how many bites were downloaded-
i think that is equivalent to the number of chars of the binary file:

 put the number of chars or url "binfile:partially_downloaded.mov" into
> numberOfBites  -- ???

It seems that this method will be dependent on the server supporting it - I
guess most Apache servers will? But more ftp servers seem to... a good
starting point is to check the "put libURLLastRHHeaders()" - If the received
headers contain an ETag line - things are looking promising:

ETag: "162bcb8-2571-eefb9fc0"

Below are some links for reference if anyone else needs to look into this:

I found the following reference - but it may be a bit windows / IE specific:

   - http://www.devx.com/dotnet/Article/22533/0/page/2
   - http://www.lassosoft.com/Documentation/TotW/index.lasso?9233

Taken from - http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16

Examples of byte-content-range-spec values, assuming that the entity
contains a total of 1234 bytes:

      . The first 500 bytes:
       bytes 0-499/1234

      . The second 500 bytes:
       bytes 500-999/1234

      . All except for the first 500 bytes:
       bytes 500-1233/1234

      . The last 500 bytes:
       bytes 734-1233/1234

When an HTTP message includes the content of a single range (for example, a
response to a request for a single range, or to a request for a set of
ranges that overlap without any holes), this content is transmitted with a
Content-Range header, and a Content-Length header showing the number of
bytes actually transferred. For example,

       HTTP/1.1 206 Partial content
       Date: Wed, 15 Nov 1995 06:25:24 GMT
       Last-Modified: Wed, 15 Nov 1995 04:58:08 GMT
       Content-Range: bytes 21010-47021/47022
       Content-Length: 26012
       Content-Type: image/gif

More information about the use-livecode mailing list