[OpenSIPS-Users] CURL library with respect to REST_API calls

Ramachandran, Agalya (Contractor) Agalya_Ramachandran at comcast.com
Mon Jun 20 19:45:21 CEST 2016


Hi team,

I have a question regarding curl library behavior with respect to curl_easy_perform API call.
Here is the snippet of the code that am using in "rest_put" API call in rest_methods.c file

  w_curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, write_func);
 w_curl_easy_setopt(handle, CURLOPT_WRITEDATA, &res_body);

When curl_easy_perform API call is success, I could able to retrieve the result body from the res_body.
But in the case of API call failure am not getting any details of the message. But getting only the http response code.
Is there a way to get the message details as well in the case where curl_easy_perform API fails?

LM_INFO(" Actual result body is %s\n", res_body.s);
When I print this, in the case of success, am getting a http response message in detail.
But in case of failure, the call back function write_func is not at all called. Why it is so?

Please guide me if there is a way to the message details in case of failure too.

Regards,
Agalya

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20160620/36281b2a/attachment.htm>


More information about the Users mailing list