cURL / Mailing Lists / curl-library / Single Mail

curl-library

CURLOPT_ERRORBUFFER not always filled

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

Hi,
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: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-06-28