aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_curl.c
diff options
context:
space:
mode:
authorGravatar Andreas Baumann <mail@andreasbaumann.cc> 2019-10-11 17:22:34 +0200
committerGravatar Andreas Baumann <mail@andreasbaumann.cc> 2019-10-11 17:22:34 +0200
commitede43c848d5ea8cb1d7fb23af1d638e6fff9aa41 (patch)
treebc646cd473372aff2717135dc3dfc212aac8c642 /plugins/check_curl.c
parent04c58e021097d0dda4d5ebbb3c2f96e45e50ffd4 (diff)
downloadmonitoring-plugins-ede43c848d5ea8cb1d7fb23af1d638e6fff9aa41.tar.gz
setting no_body to TRUE when we have a HEAD request
Diffstat (limited to 'plugins/check_curl.c')
-rw-r--r--plugins/check_curl.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index 9dea9c44..69b63446 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -387,6 +387,11 @@ check_http (void)
http_method = "GET";
handle_curl_option_return_code (curl_easy_setopt (curl, CURLOPT_URL, server_url), "CURLOPT_URL");
}
+
+ /* disable body for HEAD request */
+ if (http_method && !strcmp (http_method, "HEAD" )) {
+ no_body = TRUE;
+ }
/* set HTTP protocol version */
handle_curl_option_return_code (curl_easy_setopt (curl, CURLOPT_HTTP_VERSION, curl_http_version), "CURLOPT_HTTP_VERSION");
@@ -627,7 +632,7 @@ check_http (void)
server_port, res, curl_easy_strerror(res));
die (STATE_CRITICAL, "HTTP CRITICAL - %s\n", msg);
}
-
+
/* certificate checks */
#ifdef LIBCURL_FEATURE_SSL
if (use_ssl == TRUE) {