[monitoring-plugins] some LIBCURL_VERSION checks around HTTP/2 feature

Andreas Baumann git at monitoring-plugins.org
Sat Sep 7 16:10:11 CEST 2019


 Module: monitoring-plugins
 Branch: feature_check_curl
 Commit: 04c58e021097d0dda4d5ebbb3c2f96e45e50ffd4
 Author: Andreas Baumann <mail at andreasbaumann.cc>
   Date: Sat Sep  7 16:06:17 2019 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=04c58e0

some LIBCURL_VERSION checks around HTTP/2 feature

---

 plugins/check_curl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index 7f1f64c..9dea9c4 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -1503,8 +1503,12 @@ process_arguments (int argc, char **argv)
         curl_http_version = CURL_HTTP_VERSION_1_0;
       } else if (strcmp (optarg, "1.1") == 0) {
         curl_http_version = CURL_HTTP_VERSION_1_1;
-      } else if (strcmp (optarg, "2") == 0) {
+      } else if ((strcmp (optarg, "2.0") == 0) || (strcmp (optarg, "2") == 0)) {
+#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 33, 0)
         curl_http_version = CURL_HTTP_VERSION_2_0;
+#else
+        curl_http_version = CURL_HTTP_VERSION_NONE;
+#endif /* LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 33, 0) */
       } else {
         fprintf (stderr, "unkown http-version parameter: %s\n", optarg);
         exit (STATE_WARNING);



More information about the Commits mailing list