diff options
author | Maxim Yurchuk <maxim-yurchuk@ydb.tech> | 2024-10-18 20:31:38 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-18 20:31:38 +0300 |
commit | 2a74bac2d2d3bccb4e10120f1ead805640ec9dd0 (patch) | |
tree | 047e4818ced5aaf73f58517629e5260b5291f9f0 /contrib/libs/curl/lib/version.c | |
parent | 2d9656823e9521d8c29ea4c9a1d0eab78391abfc (diff) | |
parent | 3d834a1923bbf9403cd4a448e7f32b670aa4124f (diff) | |
download | ydb-2a74bac2d2d3bccb4e10120f1ead805640ec9dd0.tar.gz |
Merge pull request #10502 from ydb-platform/mergelibs-241016-1210
Library import 241016-1210
Diffstat (limited to 'contrib/libs/curl/lib/version.c')
-rw-r--r-- | contrib/libs/curl/lib/version.c | 95 |
1 files changed, 39 insertions, 56 deletions
diff --git a/contrib/libs/curl/lib/version.c b/contrib/libs/curl/lib/version.c index 749f8625b5..0aca34a4cd 100644 --- a/contrib/libs/curl/lib/version.c +++ b/contrib/libs/curl/lib/version.c @@ -55,7 +55,6 @@ #ifdef USE_LIBRTMP #error #include <librtmp/rtmp.h> -#include "curl_rtmp.h" #endif #ifdef HAVE_LIBZ @@ -153,7 +152,7 @@ char *curl_version(void) #ifdef USE_NGHTTP2 char h2_version[40]; #endif -#ifdef USE_HTTP3 +#ifdef ENABLE_QUIC char h3_version[40]; #endif #ifdef USE_LIBRTMP @@ -175,7 +174,8 @@ char *curl_version(void) /* Override version string when environment variable CURL_VERSION is set */ const char *debugversion = getenv("CURL_VERSION"); if(debugversion) { - msnprintf(out, sizeof(out), "%s", debugversion); + strncpy(out, debugversion, sizeof(out)-1); + out[sizeof(out)-1] = '\0'; return out; } #endif @@ -208,23 +208,11 @@ char *curl_version(void) src[i++] = idn_version; #elif defined(USE_WIN32_IDN) src[i++] = (char *)"WinIDN"; -#elif defined(USE_APPLE_IDN) - src[i++] = (char *)"AppleIDN"; #endif #ifdef USE_LIBPSL - { -#if defined(PSL_VERSION_MAJOR) && (PSL_VERSION_MAJOR > 0 || \ - PSL_VERSION_MINOR >= 11) - int num = psl_check_version_number(0); - msnprintf(psl_version, sizeof(psl_version), "libpsl/%d.%d.%d", - num >> 16, (num >> 8) & 0xff, num & 0xff); -#else - msnprintf(psl_version, sizeof(psl_version), "libpsl/%s", - psl_get_version()); -#endif - src[i++] = psl_version; - } + msnprintf(psl_version, sizeof(psl_version), "libpsl/%s", psl_get_version()); + src[i++] = psl_version; #endif #ifdef USE_SSH @@ -235,13 +223,25 @@ char *curl_version(void) Curl_http2_ver(h2_version, sizeof(h2_version)); src[i++] = h2_version; #endif -#ifdef USE_HTTP3 +#ifdef ENABLE_QUIC Curl_quic_ver(h3_version, sizeof(h3_version)); src[i++] = h3_version; #endif #ifdef USE_LIBRTMP - Curl_rtmp_version(rtmp_version, sizeof(rtmp_version)); - src[i++] = rtmp_version; + { + char suff[2]; + if(RTMP_LIB_VERSION & 0xff) { + suff[0] = (RTMP_LIB_VERSION & 0xff) + 'a' - 1; + suff[1] = '\0'; + } + else + suff[0] = '\0'; + + msnprintf(rtmp_version, sizeof(rtmp_version), "librtmp/%d.%d%s", + RTMP_LIB_VERSION >> 16, (RTMP_LIB_VERSION >> 8) & 0xff, + suff); + src[i++] = rtmp_version; + } #endif #ifdef USE_HYPER msnprintf(hyper_buf, sizeof(hyper_buf), "Hyper/%s", hyper_version()); @@ -258,11 +258,10 @@ char *curl_version(void) api.ldapai_info_version = LDAP_API_INFO_VERSION; if(ldap_get_option(NULL, LDAP_OPT_API_INFO, &api) == LDAP_OPT_SUCCESS) { - unsigned int patch = (unsigned int)(api.ldapai_vendor_version % 100); - unsigned int major = (unsigned int)(api.ldapai_vendor_version / 10000); + unsigned int patch = api.ldapai_vendor_version % 100; + unsigned int major = api.ldapai_vendor_version / 10000; unsigned int minor = - (((unsigned int)api.ldapai_vendor_version - major * 10000) - - patch) / 100; + ((api.ldapai_vendor_version - major * 10000) - patch) / 100; msnprintf(ldap_buf, sizeof(ldap_buf), "%s/%u.%u.%u", api.ldapai_vendor_name, major, minor, patch); src[i++] = ldap_buf; @@ -395,7 +394,7 @@ static const char * const supported_protocols[] = { }; /* - * Feature presence runtime check functions. + * Feature presence run-time check functions. * * Warning: the value returned by these should not change between * curl_global_init() and curl_global_cleanup() calls. @@ -419,14 +418,6 @@ static int https_proxy_present(curl_version_info_data *info) } #endif -#if defined(USE_SSL) && defined(USE_ECH) -static int ech_present(curl_version_info_data *info) -{ - (void) info; - return Curl_ssl_supports(NULL, SSLSUPP_ECH); -} -#endif - /* * Features table. * @@ -455,9 +446,6 @@ static const struct feat features_table[] = { #ifdef DEBUGBUILD FEATURE("Debug", NULL, CURL_VERSION_DEBUG), #endif -#if defined(USE_SSL) && defined(USE_ECH) - FEATURE("ECH", ech_present, 0), -#endif #ifdef USE_GSASL FEATURE("gsasl", NULL, CURL_VERSION_GSASL), #endif @@ -470,17 +458,17 @@ static const struct feat features_table[] = { #if defined(USE_NGHTTP2) FEATURE("HTTP2", NULL, CURL_VERSION_HTTP2), #endif -#if defined(USE_HTTP3) +#if defined(ENABLE_QUIC) FEATURE("HTTP3", NULL, CURL_VERSION_HTTP3), #endif #if defined(USE_SSL) && !defined(CURL_DISABLE_PROXY) && \ !defined(CURL_DISABLE_HTTP) FEATURE("HTTPS-proxy", https_proxy_present, CURL_VERSION_HTTPS_PROXY), #endif -#if defined(USE_LIBIDN2) || defined(USE_WIN32_IDN) || defined(USE_APPLE_IDN) +#if defined(USE_LIBIDN2) || defined(USE_WIN32_IDN) FEATURE("IDN", idn_present, CURL_VERSION_IDN), #endif -#ifdef USE_IPV6 +#ifdef ENABLE_IPV6 FEATURE("IPv6", NULL, CURL_VERSION_IPV6), #endif #ifdef USE_KERBEROS5 @@ -499,6 +487,10 @@ static const struct feat features_table[] = { #ifdef USE_NTLM FEATURE("NTLM", NULL, CURL_VERSION_NTLM), #endif +#if !defined(CURL_DISABLE_HTTP) && defined(USE_NTLM) && \ + defined(NTLM_WB_ENABLED) + FEATURE("NTLM_WB", NULL, CURL_VERSION_NTLM_WB), +#endif #if defined(USE_LIBPSL) FEATURE("PSL", NULL, CURL_VERSION_PSL), #endif @@ -541,7 +533,7 @@ static curl_version_info_data version_info = { LIBCURL_VERSION, LIBCURL_VERSION_NUM, OS, /* as found by configure or set by hand at build-time */ - 0, /* features bitmask is built at runtime */ + 0, /* features bitmask is built at run-time */ NULL, /* ssl_version */ 0, /* ssl_version_num, this is kept at zero */ NULL, /* zlib_version */ @@ -570,8 +562,7 @@ static curl_version_info_data version_info = { NULL, /* zstd version */ NULL, /* Hyper version */ NULL, /* gsasl version */ - feature_names, - NULL /* rtmp version */ + feature_names }; curl_version_info_data *curl_version_info(CURLversion stamp) @@ -581,7 +572,7 @@ curl_version_info_data *curl_version_info(CURLversion stamp) int features = 0; #if defined(USE_SSH) - static char ssh_buf[80]; /* 'ssh_buffer' clashes with libssh/libssh.h */ + static char ssh_buffer[80]; #endif #ifdef USE_SSL #ifdef CURL_WITH_MULTI_SSL @@ -597,7 +588,7 @@ curl_version_info_data *curl_version_info(CURLversion stamp) static char zstd_buffer[80]; #endif - (void)stamp; /* avoid compiler warnings, we do not use this */ + (void)stamp; /* avoid compiler warnings, we don't use this */ #ifdef USE_SSL Curl_ssl_version(ssl_buffer, sizeof(ssl_buffer)); @@ -622,8 +613,8 @@ curl_version_info_data *curl_version_info(CURLversion stamp) #endif #if defined(USE_SSH) - Curl_ssh_version(ssh_buf, sizeof(ssh_buf)); - version_info.libssh_version = ssh_buf; + Curl_ssh_version(ssh_buffer, sizeof(ssh_buffer)); + version_info.libssh_version = ssh_buffer; #endif #ifdef HAVE_BROTLI @@ -641,12 +632,12 @@ curl_version_info_data *curl_version_info(CURLversion stamp) #ifdef USE_NGHTTP2 { nghttp2_info *h2 = nghttp2_version(0); - version_info.nghttp2_ver_num = (unsigned int)h2->version_num; + version_info.nghttp2_ver_num = h2->version_num; version_info.nghttp2_version = h2->version_str; } #endif -#ifdef USE_HTTP3 +#ifdef ENABLE_QUIC { static char quicbuffer[80]; Curl_quic_ver(quicbuffer, sizeof(quicbuffer)); @@ -679,13 +670,5 @@ curl_version_info_data *curl_version_info(CURLversion stamp) feature_names[n] = NULL; /* Terminate array. */ version_info.features = features; -#ifdef USE_LIBRTMP - { - static char rtmp_version[30]; - Curl_rtmp_version(rtmp_version, sizeof(rtmp_version)); - version_info.rtmp_version = rtmp_version; - } -#endif - return &version_info; } |