Print libcurl error buffer to stderr on client error
This commit is contained in:
parent
e3fefe30d1
commit
ff39c82e48
@ -159,6 +159,9 @@ namespace http
|
|||||||
curl_easy_setopt(easy, CURLOPT_FOLLOWLOCATION, 1L);
|
curl_easy_setopt(easy, CURLOPT_FOLLOWLOCATION, 1L);
|
||||||
curl_easy_setopt(easy, CURLOPT_MAXREDIRS, 10L);
|
curl_easy_setopt(easy, CURLOPT_MAXREDIRS, 10L);
|
||||||
|
|
||||||
|
curl_easy_setopt(easy, CURLOPT_ERRORBUFFER, error_buffer);
|
||||||
|
error_buffer[0] = 0;
|
||||||
|
|
||||||
curl_easy_setopt(easy, CURLOPT_TIMEOUT, timeout);
|
curl_easy_setopt(easy, CURLOPT_TIMEOUT, timeout);
|
||||||
curl_easy_setopt(easy, CURLOPT_HTTPHEADER, headers);
|
curl_easy_setopt(easy, CURLOPT_HTTPHEADER, headers);
|
||||||
curl_easy_setopt(easy, CURLOPT_URL, uri.c_str());
|
curl_easy_setopt(easy, CURLOPT_URL, uri.c_str());
|
||||||
|
@ -25,6 +25,7 @@ namespace http
|
|||||||
ByteString response_body;
|
ByteString response_body;
|
||||||
|
|
||||||
CURL *easy;
|
CURL *easy;
|
||||||
|
char error_buffer[CURL_ERROR_SIZE];
|
||||||
|
|
||||||
volatile curl_off_t rm_total;
|
volatile curl_off_t rm_total;
|
||||||
volatile curl_off_t rm_done;
|
volatile curl_off_t rm_done;
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
const int curl_multi_wait_timeout_ms = 100;
|
const int curl_multi_wait_timeout_ms = 100;
|
||||||
const long curl_max_host_connections = 6;
|
const long curl_max_host_connections = 6;
|
||||||
|
|
||||||
@ -142,6 +144,11 @@ namespace http
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (finish_with >= 600)
|
||||||
|
{
|
||||||
|
std::cerr << request->error_buffer << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
request->status = finish_with;
|
request->status = finish_with;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user