cURL / Mailing Lists / curl-users / Single Mail

curl-users

Clarificaitons Regarding cURL CURLOPT_RANGE option

From: Samir Virmani <Samir_at_embedur.com>
Date: Sat, 29 Nov 2014 21:38:11 +0000

Hi,

We are using cURL to perform a http download of a file and wanted to read 1024 bytes at a time from the server hosting the file.

Based on the cURL documentation, we believe that we could use CURLOPT_RANGE to request the specified number of bytes. However, we are finding that we do not always get the number of bytes requested. The number of bytes received appears to be different from different web-servers and from different hosts to the same web server.

As an example, we are requesting for chunks of 1024 bytes from "www.microsoft.com", however the server sends out only 1020 bytes. Also, we see received bytes subsequently becomes 0 but the error code is not set as CURLE_PARTIAL_FILE.

On the other hand, when we tried downloading from a different website - "www.cisco.com" there were no issues. The requested byte ranges were sent by the server and returned with CURLE_PARTIAL_FILE once the complete file was sent.

Can you please let us know why the behavior is different on different websites? Is there something that we are missing?

Please find attached the code along with the ouput.

Looking forward for your response.

Regards,
Samir

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2014-11-29