aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-06 06:48:30 +0100
committerMax Kellermann <max@duempel.org>2008-11-06 06:48:30 +0100
commitdcfb205c46133d214e96446ea584ab6175e266ba (patch)
treef3877a4d83757b2fa8e126458412049e23466b4c
parente2d7318a184a37e7e1094dc7e783c5b0c61b66c5 (diff)
downloadmpd-dcfb205c46133d214e96446ea584ab6175e266ba.tar.gz
mpd-dcfb205c46133d214e96446ea584ab6175e266ba.tar.xz
mpd-dcfb205c46133d214e96446ea584ab6175e266ba.zip
input_curl: retrieve error message from ERRORBUFFER
libcurl provides better error messages than curl_multi_strerror() when you set the ERRORBUFFER option.
-rw-r--r--src/input_curl.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/input_curl.c b/src/input_curl.c
index fbbe5d461..f908bf245 100644
--- a/src/input_curl.c
+++ b/src/input_curl.c
@@ -70,6 +70,9 @@ struct input_curl {
/** limited list of old buffers, for rewinding */
struct list_head rewind;
+
+ /** error message provided by libcurl */
+ char error[CURL_ERROR_SIZE];
};
/** libcurl should accept "ICY 200 OK" */
@@ -154,8 +157,7 @@ input_curl_multi_info_read(struct input_stream *is)
&msgs_in_queue)) != NULL) {
if (msg->msg == CURLMSG_DONE &&
msg->data.result != CURLE_OK) {
- g_warning("curl failed: %s\n",
- curl_easy_strerror(msg->data.result));
+ g_warning("curl failed: %s\n", c->error);
is->error = -1;
c->eof = true;
return false;
@@ -454,6 +456,7 @@ input_curl_easy_init(struct input_stream *is)
curl_easy_setopt(c->easy, CURLOPT_WRITEDATA, is);
curl_easy_setopt(c->easy, CURLOPT_HTTP200ALIASES, http_200_aliases);
curl_easy_setopt(c->easy, CURLOPT_FAILONERROR, true);
+ curl_easy_setopt(c->easy, CURLOPT_ERRORBUFFER, c->error);
code = curl_easy_setopt(c->easy, CURLOPT_URL, c->url);
if (code != CURLE_OK)