cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP PUT, and the progress meter

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 8 Jun 2010 23:21:15 +0200 (CEST)

On Tue, 8 Jun 2010, Nick Jensen wrote:

> if I make a PUT request that is "not valid", Amazon will return an XML
> document saying what went wrong. This is fine, but before I receive that
> failure response (body/headers), the progress_function is getting called and
> with the 'ulnow' value > 0. This causes my UI to show that some amount of
> bytes have been uploaded before it displays the error message that was
> returned in the response.. In reality though, no bytes were uploaded. Or
> maybe they were, and just got rejected? Not sure. Either way, my question is
> how can detect what is "successful" upload progress with an HTTP PUT?

A successful PUT is one that gets a 2xx response code back. Your description
is a fully legal and possible case where libcurl gets to send off data before
it gets and reads the response from the server. It's neither wrong nor
unusual. You simply cannot use the 'ulnow' value of the progress callback as a
marker for success simply because it grows beyond 0.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-06-08