X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fcurl.c;h=ac55953c1c327bce3b34bb1a568cfeedf90174a0;hb=9c3ed6462c15fd1cb664cd0ec2a5efb289aa1af6;hp=7d3130773944f79ccee35c3fb6074c1cdbe3fe52;hpb=a6e74e0d316ee14f45093246e0e5e2d84faa8690;p=collectd.git diff --git a/src/curl.c b/src/curl.c index 7d313077..ac55953c 100644 --- a/src/curl.c +++ b/src/curl.c @@ -569,6 +569,7 @@ static int cc_init (void) /* {{{ */ INFO ("curl plugin: No pages have been defined."); return (-1); } + curl_global_init (CURL_GLOBAL_SSL); return (0); } /* }}} int cc_init */ @@ -586,7 +587,8 @@ static void cc_submit (const web_page_t *wp, const web_match_t *wm, /* {{{ */ sstrncpy (vl.plugin, "curl", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, wp->instance, sizeof (vl.plugin_instance)); sstrncpy (vl.type, wm->type, sizeof (vl.type)); - sstrncpy (vl.type_instance, wm->instance, sizeof (vl.type_instance)); + if (wm->instance != NULL) + sstrncpy (vl.type_instance, wm->instance, sizeof (vl.type_instance)); plugin_dispatch_values (&vl); } /* }}} void cc_submit */ @@ -630,7 +632,7 @@ static int cc_read_page (web_page_t *wp) /* {{{ */ { web_match_t *wm; int status; - cdtime_t start; + cdtime_t start = 0; if (wp->response_time) start = cdtime (); @@ -639,7 +641,7 @@ static int cc_read_page (web_page_t *wp) /* {{{ */ status = curl_easy_perform (wp->curl); if (status != CURLE_OK) { - ERROR ("curl plugin: curl_easy_perform failed with staus %i: %s", + ERROR ("curl plugin: curl_easy_perform failed with status %i: %s", status, wp->curl_errbuf); return (-1); } @@ -652,7 +654,7 @@ static int cc_read_page (web_page_t *wp) /* {{{ */ long response_code = 0; status = curl_easy_getinfo(wp->curl, CURLINFO_RESPONSE_CODE, &response_code); if(status != CURLE_OK) { - ERROR ("curl plugin: Fetching response code failed with staus %i: %s", + ERROR ("curl plugin: Fetching response code failed with status %i: %s", status, wp->curl_errbuf); } else { cc_submit_response_code(wp, response_code); @@ -678,6 +680,7 @@ static int cc_read_page (web_page_t *wp) /* {{{ */ } cc_submit (wp, wm, mv); + match_value_reset (mv); } /* for (wm = wp->matches; wm != NULL; wm = wm->next) */ return (0);