Removed curl_version_check

No modern and even old platform has such old components
This commit is contained in:
Evgeny Grin (Karlson2k)
2022-10-05 13:19:01 +03:00
parent 30ef790c1a
commit 2249c1f5df
6 changed files with 22 additions and 207 deletions
-8
View File
@@ -2410,14 +2410,6 @@ AS_IF([test "$enable_curl" != "no"],
enable_curl=no
])
])
AS_IF([test "$enable_curl" != "no"],
[
# Lib cURL & cURL - OpenSSL versions
AC_DEFINE([MHD_REQ_CURL_VERSION], ["7.16.4"], [required cURL version to run tests])
AC_DEFINE([MHD_REQ_CURL_OPENSSL_VERSION], ["0.9.8"], [required cURL SSL version to run tests])
AC_DEFINE([MHD_REQ_CURL_GNUTLS_VERSION], ["2.8.6"], [gnuTLS lib version - used in conjunction with cURL])
AC_DEFINE([MHD_REQ_CURL_NSS_VERSION], ["3.12.0"], [NSS lib version - used in conjunction with cURL])
])
AM_CONDITIONAL([HAVE_CURL], [test "x$enable_curl" = "xyes"])
mhd_have_libmagic="no"
+1 -2
View File
@@ -78,8 +78,7 @@ test_tls_options_SOURCES = \
test_tls_options.c \
tls_test_keys.h \
tls_test_common.h \
tls_test_common.c \
curl_version_check.c
tls_test_common.c
test_https_get_parallel_SOURCES = \
test_https_get_parallel.c \
-176
View File
@@ -1,176 +0,0 @@
/*
This file is part of libmicrohttpd
Copyright (C) 2007 Christian Grothoff
Copyright (C) 2016-2021 Evgeny Grin (Karlson2k)
libmicrohttpd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2, or (at your
option) any later version.
libmicrohttpd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with libmicrohttpd; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/**
* @file curl_version_check.c
* @brief verify required cURL version is available to run tests
* @author Sagie Amir
* @author Karlson2k (Evgeny Grin)
*/
#include "MHD_config.h"
#include "platform.h"
#include <curl/curl.h>
#ifndef WINDOWS
#include <unistd.h>
#endif
static int
parse_version_number (const char **s)
{
int i = 0;
char num[17];
while (i < 16 && ((**s >= '0') & (**s <= '9')))
{
num[i] = **s;
(*s)++;
i++;
}
num[i] = '\0';
return atoi (num);
}
static const char *
parse_version_string (const char *s, int *major, int *minor, int *micro)
{
if (! s)
return NULL;
*major = parse_version_number (&s);
if (*s != '.')
return NULL;
s++;
*minor = parse_version_number (&s);
if (*s != '.')
return NULL;
s++;
*micro = parse_version_number (&s);
return s;
}
/*
* check local libcurl version matches required version
*/
int
curl_check_version (const char *req_version)
{
const char *ver;
const char *curl_ver;
#ifdef HTTPS_SUPPORT
const char *ssl_ver;
const char *req_ssl_ver;
#endif /* HTTPS_SUPPORT */
int loc_major, loc_minor, loc_micro;
int rq_major, rq_minor, rq_micro;
ver = curl_version ();
#ifdef HAVE_MESSAGES
fprintf (stderr, "curl version: %s\n", ver);
#endif
/*
* this call relies on the cURL string to be of the exact following format :
* 'libcurl/7.16.4 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/0.6.5' OR
* 'libcurl/7.18.2 GnuTLS/2.4.0 zlib/1.2.3.3 libidn/0.6.5'
*/
curl_ver = strchr (ver, '/');
if (curl_ver == NULL)
return -1;
curl_ver++;
/* Parse version numbers */
if ( (NULL == parse_version_string (req_version, &rq_major, &rq_minor,
&rq_micro)) ||
(NULL == parse_version_string (curl_ver, &loc_major, &loc_minor,
&loc_micro)) )
return -1;
/* Compare version numbers. */
if (((loc_major > rq_major)
|| ((loc_major == rq_major) && (loc_minor > rq_minor))
|| ((loc_major == rq_major) && (loc_minor == rq_minor)
&& (loc_micro > rq_micro)) || ((loc_major == rq_major)
&& (loc_minor == rq_minor)
&& (loc_micro == rq_micro) )) == 0)
{
fprintf (stderr,
"Error: running curl test depends on local libcurl version > %s\n",
req_version);
return -1;
}
/*
* enforce required gnutls/openssl version.
* TODO use curl version string to assert use of gnutls
*/
#ifdef HTTPS_SUPPORT
ssl_ver = strchr (curl_ver, ' ');
if (ssl_ver == NULL)
return -1;
ssl_ver++;
if (strncmp ("GnuTLS", ssl_ver, strlen ("GNUtls")) == 0)
{
ssl_ver = strchr (ssl_ver, '/');
req_ssl_ver = MHD_REQ_CURL_GNUTLS_VERSION;
}
else if (strncmp ("OpenSSL", ssl_ver, strlen ("OpenSSL")) == 0)
{
ssl_ver = strchr (ssl_ver, '/');
req_ssl_ver = MHD_REQ_CURL_OPENSSL_VERSION;
}
else if (strncmp ("NSS", ssl_ver, strlen ("NSS")) == 0)
{
ssl_ver = strchr (ssl_ver, '/');
req_ssl_ver = MHD_REQ_CURL_NSS_VERSION;
}
else
{
fprintf (stderr, "Error: unrecognized curl ssl library\n");
return -1;
}
if (ssl_ver == NULL)
return -1;
ssl_ver++;
if ( (NULL == parse_version_string (req_ssl_ver, &rq_major, &rq_minor,
&rq_micro)) ||
(NULL == parse_version_string (ssl_ver, &loc_major, &loc_minor,
&loc_micro)) )
return -1;
if (((loc_major > rq_major)
|| ((loc_major == rq_major) && (loc_minor > rq_minor))
|| ((loc_major == rq_major) && (loc_minor == rq_minor)
&& (loc_micro > rq_micro)) || ((loc_major == rq_major)
&& (loc_minor == rq_minor)
&& (loc_micro == rq_micro) )) == 0)
{
fprintf (stderr,
"Error: running curl test depends on local libcurl SSL version > %s\n",
req_ssl_ver);
return -1;
}
#endif /* HTTPS_SUPPORT */
return 0;
}
@@ -44,8 +44,6 @@
#define MHD_CPU_COUNT 4
#endif
int curl_check_version (const char *req_version, ...);
/**
* used when spawning multiple threads executing curl server requests
@@ -46,8 +46,6 @@
#define MHD_CPU_COUNT 4
#endif
int curl_check_version (const char *req_version, ...);
/**
* used when spawning multiple threads executing curl server requests
*
+21 -17
View File
@@ -34,8 +34,6 @@
#include "tls_test_common.h"
#include "tls_test_keys.h"
int curl_check_version (const char *req_version, ...);
/**
* test server refuses to negotiate connections with unsupported protocol versions
*
@@ -110,28 +108,34 @@ main (int argc, char *const *argv)
if (! testsuite_curl_global_init ())
return 99;
if (curl_check_version (MHD_REQ_CURL_VERSION))
{
return 77;
}
ssl_version = curl_version_info (CURLVERSION_NOW)->ssl_version;
if (NULL == ssl_version)
if (0 == strncmp (ssl_version, "OpenSSL/", 8))
{
fprintf (stderr, "Curl does not support SSL. Cannot run the test.\n");
return 77;
if (0 == strncmp (ssl_version, "OpenSSL/0.", 10))
{
fprintf (stderr, "Curl uses too old library: %s\n", ssl_version);
curl_global_cleanup ();
return 77;
}
}
if (curl_tls_is_schannel () || curl_tls_is_sectransport ())
else if ((0 == strncmp (ssl_version, "GnuTLS/", 7)))
{
fprintf (stderr,
"libcurl TLS backend does not support this test. Skipping.\n");
#if GNUTLS_VERSION_NUMBER <= 0x020806
fprintf (stderr, "Curl uses too old library: %s\n", ssl_version);
curl_global_cleanup ();
return 77;
#else
(void) 0;
#endif
}
if (curl_tls_is_nss ())
else
{
aes128_sha = "rsa_aes_128_sha";
aes256_sha = "rsa_aes_256_sha";
if (NULL == ssl_version)
fprintf (stderr, "Curl does not support TLS.\n");
else
fprintf (stderr, "Curl uses too old library: %s\n", ssl_version);
curl_global_cleanup ();
return 77;
}
if (0 !=