From: Florian Forster Date: Sun, 8 Aug 2010 08:59:15 +0000 (+0200) Subject: curl json: Fix checking the response code. X-Git-Tag: collectd-4.9.4~27 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=74ba45134a428c971bc9274b17e8d8bd210156e3;p=collectd.git curl json: Fix checking the response code. --- diff --git a/src/curl_json.c b/src/curl_json.c index a7acc81c..e34f90aa 100644 --- a/src/curl_json.c +++ b/src/curl_json.c @@ -775,7 +775,8 @@ static int cj_curl_perform (cj_t *db, CURL *curl) /* {{{ */ curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url); curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &rc); - if (rc != 200) + /* The response code is zero if a non-HTTP transport was used. */ + if ((rc != 0) && (rc != 200)) { ERROR ("curl_json plugin: curl_easy_perform failed with response code %ld (%s)", rc, url);