diff options
author | nikita <nikita@n0.is> | 2020-04-30 14:57:43 +0200 |
---|---|---|
committer | nikita <nikita@n0.is> | 2020-04-30 14:57:43 +0200 |
commit | e78a29c1d7e4c0d9d5d2400f8935fe6c6db9852e (patch) | |
tree | fcebec99976dae264a75fccabd555af2ac77b4ad /lib/version.c | |
parent | 55ddc65827f8424ef1c6fe592da07608237cf2ae (diff) | |
parent | 53cdc2c963e33bc0cc1a51ad2df79396202e07f8 (diff) | |
download | gnurl-e78a29c1d7e4c0d9d5d2400f8935fe6c6db9852e.tar.gz gnurl-e78a29c1d7e4c0d9d5d2400f8935fe6c6db9852e.tar.bz2 gnurl-e78a29c1d7e4c0d9d5d2400f8935fe6c6db9852e.zip |
Merge tag 'curl-7_70_0'
7.70.0
Diffstat (limited to 'lib/version.c')
-rw-r--r-- | lib/version.c | 52 |
1 files changed, 37 insertions, 15 deletions
diff --git a/lib/version.c b/lib/version.c index ca4ab5717..3724c3392 100644 --- a/lib/version.c +++ b/lib/version.c @@ -85,14 +85,17 @@ static size_t brotli_version(char *buf, size_t bufsz) * generate the exact same string and never write any temporary data like * zeros in the data. */ + +#define VERSION_PARTS 14 /* number of substrings we can concatenate */ + char *curl_version(void) { - static char out[250]; + static char out[300]; char *outp; size_t outlen; - const char *src[14]; + const char *src[VERSION_PARTS]; #ifdef USE_SSL - char ssl_version[40]; + char ssl_version[200]; #endif #ifdef HAVE_LIBZ char z_version[40]; @@ -103,7 +106,7 @@ char *curl_version(void) #ifdef USE_ARES char cares_version[40]; #endif -#if defined(USE_LIBIDN2) || defined(USE_WIN32_IDN) +#if defined(USE_LIBIDN2) char idn_version[40]; #endif #ifdef USE_LIBPSL @@ -127,6 +130,16 @@ char *curl_version(void) int i = 0; int j; +#ifdef DEBUGBUILD + /* Override version string when environment variable CURL_VERSION is set */ + const char *debugversion = getenv("CURL_VERSION"); + if(debugversion) { + strncpy(out, debugversion, sizeof(out)-1); + out[sizeof(out)-1] = '\0'; + return out; + } +#endif + src[i++] = LIBCURL_NAME "/" LIBCURL_VERSION; #ifdef USE_SSL Curl_ssl_version(ssl_version, sizeof(ssl_version)); @@ -146,14 +159,11 @@ char *curl_version(void) src[i++] = cares_version; #endif #ifdef USE_LIBIDN2 - if(idn2_check_version(IDN2_VERSION)) { - msnprintf(idn_version, sizeof(idn_version), - "libidn2/%s", idn2_check_version(NULL)); - src[i++] = idn_version; - } -#elif defined(USE_WIN32_IDN) - msnprintf(idn_version, sizeof(idn_version), "WinIDN"); + msnprintf(idn_version, sizeof(idn_version), + "libidn2/%s", idn2_check_version(NULL)); src[i++] = idn_version; +#elif defined(USE_WIN32_IDN) + src[i++] = (char *)"WinIDN"; #endif #ifdef USE_LIBPSL @@ -198,6 +208,8 @@ char *curl_version(void) } #endif + DEBUGASSERT(i <= VERSION_PARTS); + outp = &out[0]; outlen = sizeof(out); for(j = 0; j < i; j++) { @@ -261,6 +273,9 @@ static const char * const protocols[] = { "ldaps", #endif #endif +#ifdef CURL_ENABLE_MQTT + "mqtt", +#endif #ifndef CURL_DISABLE_POP3 "pop3", #endif @@ -377,9 +392,6 @@ static curl_version_info_data version_info = { #if defined(USE_ALTSVC) | CURL_VERSION_ALTSVC #endif -#ifdef USE_ESNI - | CURL_VERSION_ESNI -#endif , NULL, /* ssl_version */ 0, /* ssl_version_num, this is kept at zero */ @@ -394,7 +406,17 @@ static curl_version_info_data version_info = { NULL, /* brotli version */ 0, /* nghttp2 version number */ NULL, /* nghttp2 version string */ - NULL /* quic library string */ + NULL, /* quic library string */ +#ifdef CURL_CA_BUNDLE + CURL_CA_BUNDLE, /* cainfo */ +#else + NULL, +#endif +#ifdef CURL_CA_PATH + CURL_CA_PATH /* capath */ +#else + NULL +#endif }; curl_version_info_data *curl_version_info(CURLversion stamp) |