cURL / Mailing Lists / curl-library / Single Mail

curl-library

RESUME_FROM broken when used with(out) RANGE option

From: Daniel Egger <daniel_at_eggers-club.de>
Date: Fri, 28 Dec 2007 09:47:58 +0100

Hi guys,

found the following bug:

When I specify both the RESUME_FROM and/or the RANGE option and
the connection broke down before the download will abort with an
error.

In the following example I used both setting them to the same
start byte because it is easier to reproduce but I get the same
behaviour when the connection times out and I use just the RESUME_FROM
option instead of the RANGE. Of course the error message at the bottom
is wrong and the server does support ranges as the reply shows.

startoffset = image_offset;
endoffset = image_offset + rootfs_size - 1;
snprintf (range, sizeof (range), "%d-%d", startoffset, endoffset);
curl_easy_setopt (curl, CURLOPT_RESUME_FROM, startoffset);
curl_easy_setopt (curl, CURLOPT_RANGE, range);
curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, RootfsReader);
res = curl_easy_perform (curl);

> GET /webimage_kernel_rootfs_only HTTP/1.1
Range: bytes=272-
User-Agent: Firmware Downloader/1.0
Host: 192.168.100.100
Accept: */*

< HTTP/1.1 206 Partial Content
< Date: Fri, 28 Dec 2007 08:38:46 GMT
< Server: Boa/0.94.14rc21
< Accept-Ranges: bytes
< Connection: Keep-Alive
< Keep-Alive: timeout=10, max=999
< Last-Modified: Thu, 27 Dec 2007 10:34:18 GMT
< Content-Length: 6597295
< Content-Type: text/plain
< Content-Range: bytes 272-6597566/6597567

[ Flash process ]

* transfer closed with 6252671 bytes remaining to read
* error
> GET /286506.webimage_kernel_rootfs_only HTTP/1.1
Range: bytes=344896-5714191
User-Agent: Sphairon IAD Firmware Downloader/1.0
Host: 192.168.100.100
Accept: */*

< HTTP/1.1 206 Partial Content
< Date: Fri, 28 Dec 2007 08:39:49 GMT
< Server: Boa/0.94.14rc21
< Accept-Ranges: bytes
< Connection: Keep-Alive
< Keep-Alive: timeout=10, max=1000
< Last-Modified: Thu, 27 Dec 2007 10:34:18 GMT
< Content-Length: 5369296
< Content-Type: text/plain
< Content-Range: bytes 344896-5714191/6597567
* HTTP server doesn't seem to support byte ranges. Cannot resume.
* error
Failure during download!

Servus,
       Daniel
Received on 2007-12-28