temp = realloc(st->apache_buffer, st->apache_buffer_fill + len + 1);
if (temp == NULL) {
ERROR("apache plugin: realloc failed.");
temp = realloc(st->apache_buffer, st->apache_buffer_fill + len + 1);
if (temp == NULL) {
ERROR("apache plugin: realloc failed.");
} /* int apache_curl_callback */
static size_t apache_header_callback(void *buf, size_t size, size_t nmemb,
} /* int apache_curl_callback */
static size_t apache_header_callback(void *buf, size_t size, size_t nmemb,
/* look for the Server header */
if (strncasecmp(buf, "Server: ", strlen("Server: ")) != 0)
/* look for the Server header */
if (strncasecmp(buf, "Server: ", strlen("Server: ")) != 0)
if (strstr(buf, "Apache") != NULL)
st->server_type = APACHE;
if (strstr(buf, "Apache") != NULL)
st->server_type = APACHE;
st = calloc(1, sizeof(*st));
if (st == NULL) {
ERROR("apache plugin: calloc failed.");
st = calloc(1, sizeof(*st));
if (st == NULL) {
ERROR("apache plugin: calloc failed.");
if ((st->curl = curl_easy_init()) == NULL) {
ERROR("apache plugin: init_host: `curl_easy_init' failed.");
if ((st->curl = curl_easy_init()) == NULL) {
ERROR("apache plugin: init_host: `curl_easy_init' failed.");
} /* }}} int init_host */
static void submit_value(const char *type, const char *type_instance,
} /* }}} int init_host */
static void submit_value(const char *type, const char *type_instance,
}
assert(st->curl != NULL);
st->apache_buffer_fill = 0;
if (curl_easy_perform(st->curl) != CURLE_OK) {
ERROR("apache: curl_easy_perform failed: %s", st->apache_curl_error);
}
assert(st->curl != NULL);
st->apache_buffer_fill = 0;
if (curl_easy_perform(st->curl) != CURLE_OK) {
ERROR("apache: curl_easy_perform failed: %s", st->apache_curl_error);
/* Call this while collectd is still single-threaded to avoid
* initialization issues in libgcrypt. */
curl_global_init(CURL_GLOBAL_SSL);
/* Call this while collectd is still single-threaded to avoid
* initialization issues in libgcrypt. */
curl_global_init(CURL_GLOBAL_SSL);