X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fapache.c;h=c515e3c5db57a45bc04e706db387d02b5a27ba24;hp=9c4b496ab85c9a8f44bbbda2a2fed431d432734b;hb=3307054b6ab46b51fdda4f528e72d119e9de3071;hpb=f7f5868ee0378791ccd8d1788e27ebf2a02737dc diff --git a/src/apache.c b/src/apache.c index 9c4b496a..c515e3c5 100644 --- a/src/apache.c +++ b/src/apache.c @@ -531,13 +531,16 @@ static int apache_read_host (user_data_t *user_data) /* {{{ */ st = user_data->data; + int status; + + char *content_type; + static const char *text_plain = "text/plain"; + assert (st->url != NULL); /* (Assured by `config_add') */ if (st->curl == NULL) { - int status; - status = init_host (st); if (status != 0) return (-1); @@ -560,6 +563,16 @@ static int apache_read_host (user_data_t *user_data) /* {{{ */ st->server_type = APACHE; } + status = curl_easy_getinfo (st->curl, CURLINFO_CONTENT_TYPE, &content_type); + if ((status == CURLE_OK) && (content_type != NULL) && + (strncasecmp (content_type, text_plain, strlen (text_plain)) != 0)) + { + WARNING ("apache plugin: `Content-Type' response header is not `%s' " + "(received: `%s'). Expecting unparseable data. Please check `URL' " + "parameter (missing `?auto' suffix ?)", + text_plain, content_type); + } + ptr = st->apache_buffer; saveptr = NULL; while ((line = strtok_r (ptr, "\n\r", &saveptr)) != NULL)