summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 76d9c90)
raw | patch | inline | side by side (parent: 76d9c90)
author | Marc Fournier <marc.fournier@camptocamp.com> | |
Wed, 8 Apr 2015 20:58:22 +0000 (22:58 +0200) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Wed, 8 Apr 2015 22:08:59 +0000 (00:08 +0200) |
This could be done better, but as it's a non-essential feature and
7.16.2 is 8 years old, I favor not over-complicating things.
7.16.2 is 8 years old, I favor not over-complicating things.
configure.ac | patch | blob | history | |
src/apache.c | patch | blob | history | |
src/ascent.c | patch | blob | history | |
src/bind.c | patch | blob | history | |
src/curl.c | patch | blob | history | |
src/curl_json.c | patch | blob | history | |
src/curl_xml.c | patch | blob | history | |
src/nginx.c | patch | blob | history | |
src/write_http.c | patch | blob | history |
diff --git a/configure.ac b/configure.ac
index c83805e3b1c46790935cf182b15998c860c9a08b..025bfa6fd79f9255d37a355a388df50556ac3821 100644 (file)
--- a/configure.ac
+++ b/configure.ac
[have_curlopt_username="yes"],
[have_curlopt_username="no"],
[[#include <curl/curl.h>]])
+ AC_CHECK_DECL(CURLOPT_TIMEOUT_MS,
+ [have_curlopt_timeout="yes"],
+ [have_curlopt_timeout="no"],
+ [[#include <curl/curl.h>]])
fi
fi
if test "x$with_libcurl" = "xyes"
then
AC_DEFINE(HAVE_CURLOPT_USERNAME, 1, [Define if libcurl supports CURLOPT_USERNAME option.])
fi
+
+ if test "x$have_curlopt_timeout" = "xyes"
+ then
+ AC_DEFINE(HAVE_CURLOPT_TIMEOUT_MS, 1, [Define if libcurl supports CURLOPT_TIMEOUT_MS option.])
+ fi
fi
AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
# }}}
diff --git a/src/apache.c b/src/apache.c
index 0d915b07d29a5b2e83db736fb0668e3570140c83..086a39c814541a658f9d539f5c532860867b07ea 100644 (file)
--- a/src/apache.c
+++ b/src/apache.c
if (st->cacert != NULL)
curl_easy_setopt (st->curl, CURLOPT_CAINFO, st->cacert);
+#ifdef HAVE_CURLOPT_TIMEOUT_MS
if (st->timeout >= 0)
curl_easy_setopt (st->curl, CURLOPT_TIMEOUT_MS, (long) st->timeout);
else
curl_easy_setopt (st->curl, CURLOPT_TIMEOUT_MS,
CDTIME_T_TO_MS(plugin_get_interval()));
+#endif
return (0);
} /* }}} int init_host */
diff --git a/src/ascent.c b/src/ascent.c
index 501f294f7319960828a81909d6872f0146c69388..11175af5e6104afa7b39291fd77fd45441a0cb64 100644 (file)
--- a/src/ascent.c
+++ b/src/ascent.c
if (cacert != NULL)
curl_easy_setopt (curl, CURLOPT_CAINFO, cacert);
+#ifdef HAVE_CURLOPT_TIMEOUT_MS
if (timeout != NULL)
curl_easy_setopt (curl, CURLOPT_TIMEOUT_MS, atol(timeout));
else
curl_easy_setopt (curl, CURLOPT_TIMEOUT_MS,
CDTIME_T_TO_MS(plugin_get_interval()));
+#endif
return (0);
} /* }}} int ascent_init */
diff --git a/src/bind.c b/src/bind.c
index 1108a3a6cba3a50ed75d60bb775c0d0d798fe923..ec84df46efcf8db39133090d3fa0e34df513250c 100644 (file)
--- a/src/bind.c
+++ b/src/bind.c
curl_easy_setopt (curl, CURLOPT_URL, (url != NULL) ? url : BIND_DEFAULT_URL);
curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt (curl, CURLOPT_MAXREDIRS, 50L);
+#ifdef HAVE_CURLOPT_TIMEOUT_MS
curl_easy_setopt (curl, CURLOPT_TIMEOUT_MS, (timeout >= 0) ?
(long) timeout : CDTIME_T_TO_MS(plugin_get_interval()));
+#endif
return (0);
diff --git a/src/curl.c b/src/curl.c
index 1bbeddc7a6eb87e664efe45e8b65f1350adc47a6..11da3858237f6cacb9479cbed58853dca1073b18 100644 (file)
--- a/src/curl.c
+++ b/src/curl.c
if (wp->post_body != NULL)
curl_easy_setopt (wp->curl, CURLOPT_POSTFIELDS, wp->post_body);
+#ifdef HAVE_CURLOPT_TIMEOUT_MS
if (wp->timeout >= 0)
curl_easy_setopt (wp->curl, CURLOPT_TIMEOUT_MS, (long) wp->timeout);
else
curl_easy_setopt (wp->curl, CURLOPT_TIMEOUT_MS,
CDTIME_T_TO_MS(plugin_get_interval()));
+#endif
return (0);
} /* }}} int cc_page_init_curl */
diff --git a/src/curl_json.c b/src/curl_json.c
index 5128c87410ea3b0d4a5ec781810cd6d4b699ed96..3a5a3ab87d7bd0a8320e88e5de5c4d08947d6222 100644 (file)
--- a/src/curl_json.c
+++ b/src/curl_json.c
if (db->post_body != NULL)
curl_easy_setopt (db->curl, CURLOPT_POSTFIELDS, db->post_body);
+#ifdef HAVE_CURLOPT_TIMEOUT_MS
if (db->timeout >= 0)
curl_easy_setopt (db->curl, CURLOPT_TIMEOUT_MS, (long) db->timeout);
else if (db->interval > 0)
else
curl_easy_setopt (db->curl, CURLOPT_TIMEOUT_MS,
CDTIME_T_TO_MS(plugin_get_interval()));
+#endif
return (0);
} /* }}} int cj_init_curl */
diff --git a/src/curl_xml.c b/src/curl_xml.c
index 32a48c511afcf6e9c636117a0955cf96b882d816..9049d9901f0733aec8cbd284b1335337f3c2ea5d 100644 (file)
--- a/src/curl_xml.c
+++ b/src/curl_xml.c
if (db->post_body != NULL)
curl_easy_setopt (db->curl, CURLOPT_POSTFIELDS, db->post_body);
+#ifdef HAVE_CURLOPT_TIMEOUT_MS
if (db->timeout >= 0)
curl_easy_setopt (db->curl, CURLOPT_TIMEOUT_MS, (long) db->timeout);
else
curl_easy_setopt (db->curl, CURLOPT_TIMEOUT_MS,
CDTIME_T_TO_MS(plugin_get_interval()));
+#endif
return (0);
} /* }}} int cx_init_curl */
diff --git a/src/nginx.c b/src/nginx.c
index 1c537a85e46e7ac80e1502f3647a9f29fa6bdd64..4e4ce3bbc6115572873668a76507f80ccd82b316 100644 (file)
--- a/src/nginx.c
+++ b/src/nginx.c
curl_easy_setopt (curl, CURLOPT_CAINFO, cacert);
}
+#ifdef HAVE_CURLOPT_TIMEOUT_MS
if (timeout != NULL)
{
curl_easy_setopt (curl, CURLOPT_TIMEOUT_MS, atol(timeout));
curl_easy_setopt (curl, CURLOPT_TIMEOUT_MS,
CDTIME_T_TO_MS(plugin_get_interval()));
}
+#endif
return (0);
} /* void init */
diff --git a/src/write_http.c b/src/write_http.c
index 3b594be497ae371ac53e66098dfb3a6115d646dc..ed596bbf56b9e9ee88becd425126951a4591fb91 100644 (file)
--- a/src/write_http.c
+++ b/src/write_http.c
(long) cb->low_speed_time);
}
+#ifdef HAVE_CURLOPT_TIMEOUT_MS
if (cb->timeout > 0)
curl_easy_setopt (cb->curl, CURLOPT_TIMEOUT_MS, (long) cb->timeout);
+#endif
curl_easy_setopt (cb->curl, CURLOPT_NOSIGNAL, 1L);
curl_easy_setopt (cb->curl, CURLOPT_USERAGENT, COLLECTD_USERAGENT);