diff options
author | Christian Hesse <mail@eworm.de> | 2016-10-10 10:07:29 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2016-10-10 10:07:29 +0200 |
commit | a102371a873912c8817e1a84910aecb20835a6c4 (patch) | |
tree | 9c1b2329c0ae137055cab6c7f990710c48dbf457 | |
parent | 27f2e9534ceda3696de70d20a25e7bc8623fbd1c (diff) | |
download | pacredir-a102371a873912c8817e1a84910aecb20835a6c4.tar.gz pacredir-a102371a873912c8817e1a84910aecb20835a6c4.tar.zst |
add printing curl error messages
-rw-r--r-- | pacredir.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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; |