curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Read from specified location

From: jeev2000 via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 03 Aug 2021 10:10:19 +0000

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Monday, August 2nd, 2021 at 9:33 PM, Tomalak Geret'kal via curl-library <curl-library_at_cool.haxx.se> wrote:

> On 02/08/2021 16:01, jeev2000 via curl-library wrote:
>
>> hello,
>>
>> If accept ranges are not supported, how to seek and start a read from specific location.
>>
>> I am using Read callback using CURLOPT_WRITEFUNCTION. I don't see any option to be specified for reading from specifed location. Everytime the read starts from the beginning.
>>
>> thankyou.
>
> Not supported by whom? If you want to specify an Accept-Range in the HTTP headers, you can simply do that. If the server doesn't support it, that's odd, and means you'll need to just ignore the bytes you don't need inside your CURLOPT_WRITEFUNCTION. There's no magic here: just literally do nothing with the bytes.
>
> Cheers

Hi,

thank you!

Not supported by server. Becuase according to curl documentation "the HTTP standard (RFC 7233 section 3.1) allows servers to ignore range requests so even when you set CURLOPT_RANGE for a request, you may end up getting the full response sent back".
Ignoring bytes can be done in the callback. But downloading the file from beginning for every perform call will be too much. That's why the ask of starting the read from specified location.
Anyways can we use CURLOPT_RESUME_FROM in such cases? Also does it use Range request internally to achieve this.

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html
Received on 2021-08-03