cURL / Mailing Lists / curl-library / Single Mail


Re: HTTP PUT, and the progress meter

From: Daniel Stenberg <>
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.

List admin:
Received on 2010-06-08