input_curl: retrieve error message from ERRORBUFFER
libcurl provides better error messages than curl_multi_strerror() when you set the ERRORBUFFER option.
This commit is contained in:
parent
e2d7318a18
commit
dcfb205c46
@ -70,6 +70,9 @@ struct input_curl {
|
|||||||
|
|
||||||
/** limited list of old buffers, for rewinding */
|
/** limited list of old buffers, for rewinding */
|
||||||
struct list_head rewind;
|
struct list_head rewind;
|
||||||
|
|
||||||
|
/** error message provided by libcurl */
|
||||||
|
char error[CURL_ERROR_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
/** libcurl should accept "ICY 200 OK" */
|
/** libcurl should accept "ICY 200 OK" */
|
||||||
@ -154,8 +157,7 @@ input_curl_multi_info_read(struct input_stream *is)
|
|||||||
&msgs_in_queue)) != NULL) {
|
&msgs_in_queue)) != NULL) {
|
||||||
if (msg->msg == CURLMSG_DONE &&
|
if (msg->msg == CURLMSG_DONE &&
|
||||||
msg->data.result != CURLE_OK) {
|
msg->data.result != CURLE_OK) {
|
||||||
g_warning("curl failed: %s\n",
|
g_warning("curl failed: %s\n", c->error);
|
||||||
curl_easy_strerror(msg->data.result));
|
|
||||||
is->error = -1;
|
is->error = -1;
|
||||||
c->eof = true;
|
c->eof = true;
|
||||||
return false;
|
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_WRITEDATA, is);
|
||||||
curl_easy_setopt(c->easy, CURLOPT_HTTP200ALIASES, http_200_aliases);
|
curl_easy_setopt(c->easy, CURLOPT_HTTP200ALIASES, http_200_aliases);
|
||||||
curl_easy_setopt(c->easy, CURLOPT_FAILONERROR, true);
|
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);
|
code = curl_easy_setopt(c->easy, CURLOPT_URL, c->url);
|
||||||
if (code != CURLE_OK)
|
if (code != CURLE_OK)
|
||||||
|
Loading…
Reference in New Issue
Block a user