Code

patches: Added bts592623-curl_json-file.
[pkg-collectd.git] / debian / patches / bts592623-curl_json-file.dpatch
diff --git a/debian/patches/bts592623-curl_json-file.dpatch b/debian/patches/bts592623-curl_json-file.dpatch
new file mode 100755 (executable)
index 0000000..d143bc8
--- /dev/null
@@ -0,0 +1,22 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## bts592623-curl_json-file.dpatch by Florian Forster <octo@verplant.org>
+##
+## DP: curl json: Fix checking the response code.
+## DP:
+## DP: This fixes access to file:// URLs.
+
+@DPATCH@
+
+diff a/src/curl_json.c b/src/curl_json.c
+--- 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);