cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_RANGE -> chunks -> how to remove MIME-Header-Foo ?

From: Tim Bannister <isoma_at_jellybaby.net>
Date: Tue, 14 Jun 2011 16:30:35 +0100

On Tue, Jun 14, 2011, Daniel Stenberg wrote:
> On Tue, 14 Jun 2011, Rieker Flaik wrote:
>
>>I do need to test a hash-tag which is in the first 200 bytes - and if
>>this differs from the local hash-tag the full file will be downloaded.
>>So yes, I need this CURLOPT_RANGE and it's very helpful.
>
>No, that seems like a flawed reason.
>
>You say you first want the first 200 bytes and *if the contents
>differs* then you want the full/rest of the file, so why ask for
>both ranges at once? If you just as well can ask for both ranges at
>once (which is the full file) then why use the range header at all
>in the first place when you can just ask for the whole thing and
>hash the first 200 bytes once they've arrived?
>
>I would expect you to first do a range request for the first 200
>bytes, and if you find that the contents differ then you do a
>*second* request for the remainder of the file. No mime parser
>needed for that!

It can be risky asking for just the remainder of the file, in case the
document has changed since your first request. One way to deal with this
is to send an If-Range: header, but given that it's only 200 extra bytes
it will be simpler to make the second request be for the whole document
(no CURLOPT_RANGE / Range: header needed here).

-- 
Tim Bannister
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-06-14