cURL / Mailing Lists / curl-library / Single Mail


Re: How to capture Error message from the Server

From: Ray Satiro via curl-library <>
Date: Tue, 17 May 2016 15:18:12 -0400

On 5/17/2016 2:36 PM, Colin Ngam wrote:
> In a PUT situation, you can register a callback to capture any
> messages from the Server. However, in the case of a GET, since the
> callback is used for receiving data from the server, how do you get
> error messages from the Server if any? How do you tell the difference
> when the callback is called that it is data or an extended error
> message from the Server?

After curl_easy_perform returns check the HTTP response code [1] in
addition to its return code. It's also possible to fail on error [2] but
that closes the connection for each failure (ie another one will be
opened for the next request to that server), which may not be good
depending on your circumstances.


List admin:
Received on 2016-05-17