curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Ranged PUTs, Content-Range, and Content-Length

From: Christopher Head via curl-library <curl-library_at_cool.haxx.se>
Date: Thu, 2 May 2019 07:28:42 -0700

On Tue, 30 Apr 2019 03:21:28 -0400
Ray Satiro via curl-library <curl-library_at_cool.haxx.se> wrote:

> CURLOPT_RANGE specifically as far as I know is only supposed to be
> used for download, not upload (can anyone confirm?), which would
> explain what you observed [1]. Anyway, I think what Amazon is doing
> is unusual and you'd have to use CURLOPT_READFUNCTION and
> CURLOPT_SEEKFUNCTION (adding in your offset) and set Content-Range
> and amazon specific headers yourself.

And yet, looking at the source code, there are explicit conditionals to
check for CURLOPT_RANGE and turn it into a Content-Range header in an
upload. So obviously this works, and not just by accident: someone
intentionally took the time to write code that makes CURLOPT_RANGE (and
CURLOPT_RESUME_FROM, for that matter) work for uploads as well. In
current master (028126281901fb651819821f5c05caaf40976209), see the
conditional in lib/http.c starting at line 2458.

-- 
Christopher Head

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html

Received on 2019-05-02