diff --git a/src/apache.c b/src/apache.c
index c731908a291cb05dfa75ce000c369892757baac7..530481be3f802b88bb4582a14dd9aef84612eef5 100644 (file)
--- a/src/apache.c
+++ b/src/apache.c
# define APACHE_HAVE_READ 0
#endif
# define APACHE_HAVE_READ 0
#endif
-static char *url = NULL;
-static char *user = NULL;
-static char *pass = NULL;
+static char *url = NULL;
+static char *user = NULL;
+static char *pass = NULL;
+static char *cacert = NULL;
#if HAVE_LIBCURL
static CURL *curl = NULL;
#if HAVE_LIBCURL
static CURL *curl = NULL;
-static char apache_buffer[4096];
+#define ABUFFER_SIZE 16384
+static char apache_buffer[ABUFFER_SIZE];
static int apache_buffer_len = 0;
static char apache_curl_error[CURL_ERROR_SIZE];
#endif /* HAVE_LIBCURL */
static int apache_buffer_len = 0;
static char apache_curl_error[CURL_ERROR_SIZE];
#endif /* HAVE_LIBCURL */
"URL",
"User",
"Password",
"URL",
"User",
"Password",
+ "CACert",
NULL
};
NULL
};
-static int config_keys_num = 3;
+static int config_keys_num = 4;
#if HAVE_LIBCURL
static size_t apache_curl_callback (void *buf, size_t size, size_t nmemb, void *stream)
{
size_t len = size * nmemb;
#if HAVE_LIBCURL
static size_t apache_curl_callback (void *buf, size_t size, size_t nmemb, void *stream)
{
size_t len = size * nmemb;
- if ((apache_buffer_len + len) >= 4096)
+ if ((apache_buffer_len + len) >= ABUFFER_SIZE)
{
{
- len = 4095 - apache_buffer_len;
+ len = (ABUFFER_SIZE - 1) - apache_buffer_len;
}
if (len <= 0)
}
if (len <= 0)
return (config_set (&user, value));
else if (strcasecmp (key, "password") == 0)
return (config_set (&pass, value));
return (config_set (&user, value));
else if (strcasecmp (key, "password") == 0)
return (config_set (&pass, value));
+ else if (strcasecmp (key, "cacert") == 0)
+ return (config_set (&cacert, value));
else
return (-1);
}
else
return (-1);
}
{
curl_easy_setopt (curl, CURLOPT_URL, url);
}
{
curl_easy_setopt (curl, CURLOPT_URL, url);
}
+
+ if (cacert != NULL)
+ {
+ curl_easy_setopt (curl, CURLOPT_CAINFO, cacert);
+ }
#endif /* HAVE_LIBCURL */
}
#endif /* HAVE_LIBCURL */
}
if (url == NULL)
return;
if (url == NULL)
return;
+ apache_buffer_len = 0;
if (curl_easy_perform (curl) != 0)
{
syslog (LOG_WARNING, "apache: curl_easy_perform failed: %s", apache_curl_error);
if (curl_easy_perform (curl) != 0)
{
syslog (LOG_WARNING, "apache: curl_easy_perform failed: %s", apache_curl_error);