aboutsummaryrefslogtreecommitdiffstats
path: root/pacredir.c
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2016-10-10 10:07:29 +0200
committerGravatar Christian Hesse <mail@eworm.de>2016-10-10 10:07:29 +0200
commita102371a873912c8817e1a84910aecb20835a6c4 (patch)
tree9c1b2329c0ae137055cab6c7f990710c48dbf457 /pacredir.c
parent27f2e9534ceda3696de70d20a25e7bc8623fbd1c (diff)
downloadpacredir-a102371a873912c8817e1a84910aecb20835a6c4.tar.gz
pacredir-a102371a873912c8817e1a84910aecb20835a6c4.tar.zst
add printing curl error messages
Diffstat (limited to 'pacredir.c')
-rw-r--r--pacredir.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pacredir.c b/pacredir.c
index 2e049e8..ef7220a 100644
--- a/pacredir.c
+++ b/pacredir.c
@@ -216,6 +216,7 @@ static void * get_http_code(void * data) {
struct request * request = (struct request *)data;
CURL *curl;
CURLcode res;
+ char errbuf[CURL_ERROR_SIZE];
struct timeval tv;
gettimeofday(&tv, NULL);
@@ -239,10 +240,13 @@ static void * get_http_code(void * data) {
* this should make curl finish after a maximum of 8 seconds */
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1L);
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 3L);
+ /* provide a buffer to store errors in */
+ curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errbuf);
/* perform the request */
if (curl_easy_perform(curl) != CURLE_OK) {
- write_log(stderr, "Could not connect to server %s on port %d.\n", request->host, request->service->port);
+ write_log(stderr, "Could not connect to server %s on port %d: %s\n",
+ request->host, request->service->port, errbuf);
request->http_code = 0;
request->last_modified = 0;
request->service->badtime = tv.tv_sec;