cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: using libcurl for HTTP PUT -> but curl_easy_perform always returns CURLE_OK

From: Pit Müller <fmi-soft_at_gmx.de>
Date: Tue, 03 Jul 2012 17:35:33 +0200

Am 03.07.2012 13:41, schrieb Yehezkel Horowitz:
>> it returns CURLE_OK although the url i want to upload to is not allowed for upload.
>> CURLINFO_RESPONSE_CODE returns 403
>> CURLE_HTTP_RETURNED_ERROR or CURLE_UPLOAD_FAILED would be expected.
>> Any suggestions for that?
> CURLE_OK means that the HTTP transaction completed successfully and you got the response from the server.
>
> You could get the HTTP status code using curl_easy_getinfo (as you did).
>
> Since you have an "easy" way to get this information, I don't think there is a real issue here.
>
>
Thank you for your response!

But why does curl have those error codes like :
CURLE_HTTP_RETURNED_ERROR or CURLE_UPLOAD_FAILED
if it doesn't use them in this situation.

In my case the upload really failed and HTTP returned an error and not
a single byte was uploaded :-)

What is the official way for error handling here?
Should i generally ignore the return value and always check only
CURLINFO_RESPONSE_CODE?

Kind regards
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-07-03