X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcurl.c;h=69a5b9561c12c0e0f58a9e0e9b16716f84e7f777;hb=7a6887ad7eef33e04bcb0720c213d05fd9be8a59;hp=bc11c28afdaf149154e1f2bf83fd333769f4c6c1;hpb=9988d61c84dfff5d04ddf48f4b93f6c9449cdc41;p=collectd.git diff --git a/src/curl.c b/src/curl.c index bc11c28a..69a5b956 100644 --- a/src/curl.c +++ b/src/curl.c @@ -37,6 +37,7 @@ typedef struct web_match_s web_match_t; struct web_match_s /* {{{ */ { char *regex; + char *exclude_regex; int dstype; char *type; char *instance; @@ -291,6 +292,8 @@ static int cc_config_add_match (web_page_t *page, /* {{{ */ if (strcasecmp ("Regex", child->key) == 0) status = cc_config_add_string ("Regex", &match->regex, child); + else if (strcasecmp ("ExcludeRegex", child->key) == 0) + status = cc_config_add_string ("ExcludeRegex", &match->exclude_regex, child); else if (strcasecmp ("DSType", child->key) == 0) status = cc_config_add_match_dstype (&match->dstype, child); else if (strcasecmp ("Type", child->key) == 0) @@ -333,7 +336,8 @@ static int cc_config_add_match (web_page_t *page, /* {{{ */ if (status != 0) return (status); - match->match = match_create_simple (match->regex, match->dstype); + match->match = match_create_simple (match->regex, match->exclude_regex, + match->dstype); if (match->match == NULL) { ERROR ("curl plugin: tail_match_add_match_simple failed."); @@ -366,13 +370,14 @@ static int cc_page_init_curl (web_page_t *wp) /* {{{ */ return (-1); } + curl_easy_setopt (wp->curl, CURLOPT_NOSIGNAL, 1L); curl_easy_setopt (wp->curl, CURLOPT_WRITEFUNCTION, cc_curl_callback); curl_easy_setopt (wp->curl, CURLOPT_WRITEDATA, wp); curl_easy_setopt (wp->curl, CURLOPT_USERAGENT, PACKAGE_NAME"/"PACKAGE_VERSION); curl_easy_setopt (wp->curl, CURLOPT_ERRORBUFFER, wp->curl_errbuf); curl_easy_setopt (wp->curl, CURLOPT_URL, wp->url); - curl_easy_setopt (wp->curl, CURLOPT_FOLLOWLOCATION, 1); + curl_easy_setopt (wp->curl, CURLOPT_FOLLOWLOCATION, 1L); if (wp->user != NULL) { @@ -394,9 +399,9 @@ static int cc_page_init_curl (web_page_t *wp) /* {{{ */ curl_easy_setopt (wp->curl, CURLOPT_USERPWD, wp->credentials); } - curl_easy_setopt (wp->curl, CURLOPT_SSL_VERIFYPEER, wp->verify_peer); + curl_easy_setopt (wp->curl, CURLOPT_SSL_VERIFYPEER, (long) wp->verify_peer); curl_easy_setopt (wp->curl, CURLOPT_SSL_VERIFYHOST, - wp->verify_host ? 2 : 0); + wp->verify_host ? 2L : 0L); if (wp->cacert != NULL) curl_easy_setopt (wp->curl, CURLOPT_CAINFO, wp->cacert); @@ -573,7 +578,6 @@ static void cc_submit (const web_page_t *wp, const web_match_t *wm, /* {{{ */ vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "curl", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, wp->instance, sizeof (vl.plugin_instance)); @@ -592,7 +596,6 @@ static void cc_submit_response_time (const web_page_t *wp, double seconds) /* {{ vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "curl", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, wp->instance, sizeof (vl.plugin_instance));