]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix HTTP 2.0 checks
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 13 Mar 2019 11:54:45 +0000 (19:54 +0800)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 13 Mar 2019 11:54:45 +0000 (19:54 +0800)
src/modules/rlm_rest/rest.h
src/modules/rlm_rest/rlm_rest.c

index 6d0e352946bccd778b2bdb01fbd04a09809a6367..21b348518ad8a97c46eecbdb91a09e7bb888d75e 100644 (file)
@@ -29,6 +29,15 @@ RCSIDH(other_h, "$Id$")
 #include "config.h"
 
 #define CURL_NO_OLDIES 1
+
+/*
+ *     We have to use this as curl uses lots of enums
+ */
+#ifndef CURL_AT_LEAST_VERSION
+#  define CURL_VERSION_BITS(x, y, z) ((x) << 16 | (y) << 8 | z)
+#  define CURL_AT_LEAST_VERSION(x, y, z) (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
+#endif
+
 #include <curl/curl.h>
 
 /*
index 1bea094bf774d1fa916c2cc7db127f1dcf9b5b7e..f116108f326ca338cd4fa0028a71dd960ca60e3a 100644 (file)
@@ -38,15 +38,18 @@ static FR_NAME_NUMBER const http_negotiation_table[] = {
                                                                ///< libcurl will use whatever it thinks fit.
        { "1.0",        CURL_HTTP_VERSION_1_0 },                //!< Enforce HTTP 1.0 requests.
        { "1.1",        CURL_HTTP_VERSION_1_1 },                //!< Enforce HTTP 1.1 requests.
-#ifdef CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE
+/*
+ *     These are all enum values
+ */
+#if CURL_AT_LEAST_VERSION(7,49,0)
        { "2.0",        CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE },  //!< Enforce HTTP 2.0 requests.
 #endif
-#ifdef CURL_HTTP_VERSION_2_0
+#if CURL_AT_LEAST_VERSION(7,33,0)
        { "2.0+auto",   CURL_HTTP_VERSION_2_0 },                //!< Attempt HTTP 2 requests. libcurl will fall back
                                                                ///< to HTTP 1.1 if HTTP 2 can't be negotiated with the
                                                                ///< server. (Added in 7.33.0)
 #endif
-#ifdef CURL_HTTP_VERSION_2TLS
+#if CURL_AT_LEAST_VERSION(7,47,0)
        { "2.0+tls",    CURL_HTTP_VERSION_2TLS },               //!< Attempt HTTP 2 over TLS (HTTPS) only.
                                                                ///< libcurl will fall back to HTTP 1.1 if HTTP 2
                                                                ///< can't be negotiated with the HTTPS server.