cURL / Mailing Lists / curl-library / Single Mail


CURLOPT_ERRORBUFFER not always filled

From: Colin Hogben <>
Date: Sat, 28 Jun 2014 21:56:56 +0100

I was a little surprised to find that for some error codes, no error
message was placed in the buffer I had supplied with
CURLOPT_ERRORBUFFER. On re-reading the manual page, I had to admit that
it says "libcurl may store human readable error messages" without
expanding on the circumstances when it may or may not.

Could I suggest adding something along the lines of:

"The recommended way to get a human readable error message is as
follows. Before the performing transfer, store a null byte in the first
character of the buffer. After the transfer completes with a non-zero
CURLcode, check if the first byte of the buffer is still null - if not,
use the message which libcurl has placed there; if it is still null,
call curl_easy_strerror with the CURLcode to obtain a message."

Colin Hogben
List admin:
Received on 2014-06-28