diff --git a/src/apache.c b/src/apache.c
index 9c4b496ab85c9a8f44bbbda2a2fed431d432734b..5b6914c4d2e0fc040fe83f78f3cdf6a5f62b6c37 100644 (file)
--- a/src/apache.c
+++ b/src/apache.c
ssnprintf (callback_name, sizeof (callback_name),
"apache/%s/%s",
(st->host != NULL) ? st->host : hostname_g,
- (st->name != NULL) ? st->name : "default"),
+ (st->name != NULL) ? st->name : "default");
status = plugin_register_complex_read (/* group = */ NULL,
/* name = */ callback_name,
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);
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)