curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_easy_getinfo return codes

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 8 Feb 2018 10:28:49 +0100 (CET)

On Wed, 7 Feb 2018, surya chandrika wrote:

> res = curl_easy_getinfo( e, CURLINFO_RESPONSE_CODE, &response_code )
>
> if curl_easy_getinfo returns a value res != CURLE_OK, Please let me know
> 1. Should i re-try this request.

If curl_easy_getinfo() returns an error, you can rarely fix that by trying the
request again. The problem is probably more fundamental than so.

> Would the error code returned by this function same as in the below list:
> https://curl.haxx.se/libcurl/c/libcurl-errors.html

The key is that this function returns a CURLcode, as do many libcurl
functions. So yes, the list on that web page also includes what
curl_easy_getinfo() can return. Obviously curl_easy_getinfo() will only ever
return a subset of the available return codes.

> Or is it like in case if res != CURLE_OK, it would have a valid
> response_code , which could be looked upon for further actions.

If you get CURLE_OK back, libcurl returned information without a problem. The
information may still be that there was no response code available. As
documented on the options man page:
https://curl.haxx.se/libcurl/c/CURLINFO_RESPONSE_CODE.html

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2018-02-08