libURL and Resumable Downloads
Dave Cragg
dave.cragg at lacscentre.co.uk
Sat Jan 6 04:05:47 EST 2007
On 5 Jan 2007, at 22:12, Derek Bump wrote:
> Does libURL support resumable downloads via HTTP yet? I was
> looking at it a long time ago and it seems that if you just pass
> the start-byte number within the headers that it can be done
> (provided the server supports it). Though, it was not supported by
> libURL at the time.
If you know the range of bytes you want to download, you can set the
Range header.
For example, to get the first 500 bytes of a file:
set the httpHeaders to "Range: bytes=0-499"
Or to get the final 500 bytes:
set the httpHeaders to "Range: bytes=-500"
You can see a description of byte-range settings here:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35
Not all servers may support this, so you should perhaps check the
response from the server using libUrlLastRHHeaders(). The following
is a typical response to the second example above.
HTTP/1.1 206 Partial Content
Date: Sat, 06 Jan 2007 08:54:54 GMT
Server: Apache/2.0.46 (Red Hat)
Last-Modified: Tue, 04 Oct 2005 10:48:15 GMT
ETag: "27403a0-7a9-6dd019c0"
Accept-Ranges: bytes
Content-Length: 500
Content-Range: bytes 1461-1960/1961
Connection: close
Content-Type: text/html
Cheers
Dave
More information about the use-livecode
mailing list