From dcfb205c46133d214e96446ea584ab6175e266ba Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 6 Nov 2008 06:48:30 +0100 Subject: input_curl: retrieve error message from ERRORBUFFER libcurl provides better error messages than curl_multi_strerror() when you set the ERRORBUFFER option. --- src/input_curl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') 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) -- cgit v1.2.3