commit a08cfbe742ad15174a7b0d6cf12f53e9a686f99b
parent 69854dc4359ae3ba16ddd65d51741bdf302d8cfb
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Sun, 12 Dec 2021 15:01:17 +0300
Fixed tests compatibility with old libcurl
Diffstat:
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/src/testcurl/test_get_close_keep_alive.c b/src/testcurl/test_get_close_keep_alive.c
@@ -57,6 +57,14 @@
#include <limits.h>
#endif /* HAVE_LIMITS_H */
+#ifndef CURL_VERSION_BITS
+#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z))
+#endif /* ! CURL_VERSION_BITS */
+#ifndef CURL_AT_LEAST_VERSION
+#define CURL_AT_LEAST_VERSION(x,y,z) \
+ (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
+#endif /* ! CURL_AT_LEAST_VERSION */
+
#if defined(MHD_CPU_COUNT) && (MHD_CPU_COUNT + 0) < 2
#undef MHD_CPU_COUNT
#endif
diff --git a/src/testcurl/test_tricky.c b/src/testcurl/test_tricky.c
@@ -54,6 +54,14 @@
#include <limits.h>
#endif /* HAVE_LIMITS_H */
+#ifndef CURL_VERSION_BITS
+#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z))
+#endif /* ! CURL_VERSION_BITS */
+#ifndef CURL_AT_LEAST_VERSION
+#define CURL_AT_LEAST_VERSION(x,y,z) \
+ (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
+#endif /* ! CURL_AT_LEAST_VERSION */
+
#if defined(MHD_CPU_COUNT) && (MHD_CPU_COUNT + 0) < 2
#undef MHD_CPU_COUNT
#endif
@@ -486,8 +494,10 @@ curlEasyInitForTest (struct curlQueryParams *p,
lcurl_hdr_callback)) ||
(CURLE_OK != curl_easy_setopt (c, CURLOPT_HEADERDATA,
hdr_chk_result)) ||
+#if CURL_AT_LEAST_VERSION (7, 42, 0)
(CURLE_OK != curl_easy_setopt (c, CURLOPT_PATH_AS_IS,
(long) 1)) ||
+#endif /* CURL_AT_LEAST_VERSION(7, 42, 0) */
(CURLE_OK != curl_easy_setopt (c, CURLOPT_FAILONERROR, 1L)) ||
(oneone) ?
(CURLE_OK != curl_easy_setopt (c, CURLOPT_HTTP_VERSION,