curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Strange behavior of HTTP upload when resuming without seek function

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 12 Nov 2016 00:43:59 +0100 (CET)

On Thu, 10 Nov 2016, Johan Uppman wrote:

> I just recently created a simple function for uploading files to a HTTP
> server using libcurl and noticed a strange behavior when I used the
> CURLOPT_RESUME_FROM/CURLOPT_RESUME_FROM_LARGE. I will try to explain the
> situation and behavior below.

...

> Thus if no seek function is specified libcurl will simply reduce the number
> of bytes to read and read them from the beginning of the file. Should not
> the proper behavior be to fallback to the "readuntil" method if not seek
> function is specified or possible to indicate an error, not silently go
> ahead and upload the wrong bytes?

That does indeed sound like a reasonable thing to do.

Just note that resumed uploads are not a defined thing in HTTP. Ie it won't
work univerally and thus this is a fairly unused code path, which could
explain why nobody else has fixed/reported it before.

Did you try to adjust the code and see if it made your case work?

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html
Received on 2016-11-12