1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

version: include hyper version

This commit is contained in:
Daniel Stenberg 2020-12-14 14:10:33 +01:00
parent 8a113ba93c
commit 9211cb2034
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
3 changed files with 24 additions and 5 deletions

View File

@ -867,6 +867,7 @@ CURLVERSION_EIGHTH 7.72.0
CURLVERSION_FIFTH 7.57.0
CURLVERSION_FIRST 7.10
CURLVERSION_FOURTH 7.16.1
CURLVERSION_NINTH 7.75.0
CURLVERSION_NOW 7.10
CURLVERSION_SECOND 7.11.1
CURLVERSION_SEVENTH 7.70.0

View File

@ -2849,6 +2849,7 @@ typedef enum {
CURLVERSION_SIXTH,
CURLVERSION_SEVENTH,
CURLVERSION_EIGHTH,
CURLVERSION_NINTH,
CURLVERSION_LAST /* never actually use this */
} CURLversion;
@ -2857,7 +2858,7 @@ typedef enum {
meant to be a built-in version number for what kind of struct the caller
expects. If the struct ever changes, we redefine the NOW to another enum
from above. */
#define CURLVERSION_NOW CURLVERSION_EIGHTH
#define CURLVERSION_NOW CURLVERSION_NINTH
struct curl_version_info_data {
CURLversion age; /* age of the returned struct */
@ -2908,6 +2909,8 @@ struct curl_version_info_data {
(MAJOR << 24) | (MINOR << 12) | PATCH */
const char *zstd_version; /* human readable string. */
/* These fields were added in CURLVERSION_NINTH */
const char *hyper_version; /* human readable string. */
};
typedef struct curl_version_info_data curl_version_info_data;

View File

@ -100,7 +100,7 @@ static size_t zstd_version(char *buf, size_t bufsz)
* zeros in the data.
*/
#define VERSION_PARTS 14 /* number of substrings we can concatenate */
#define VERSION_PARTS 15 /* number of substrings we can concatenate */
char *curl_version(void)
{
@ -143,6 +143,9 @@ char *curl_version(void)
#endif
#ifdef USE_LIBRTMP
char rtmp_version[40];
#endif
#ifdef USE_HYPER
char hyper_buf[30];
#endif
int i = 0;
int j;
@ -228,6 +231,10 @@ char *curl_version(void)
src[i++] = rtmp_version;
}
#endif
#ifdef USE_HYPER
msnprintf(hyper_buf, sizeof(hyper_buf), "Hyper/%s", hyper_version());
src[i++] = hyper_buf;
#endif
DEBUGASSERT(i <= VERSION_PARTS);
@ -397,7 +404,7 @@ static curl_version_info_data version_info = {
#if defined(USE_TLS_SRP)
| CURL_VERSION_TLSAUTH_SRP
#endif
#if defined(USE_NGHTTP2)
#if defined(USE_NGHTTP2) || defined(USE_HYPER)
| CURL_VERSION_HTTP2
#endif
#if defined(ENABLE_QUIC)
@ -450,7 +457,8 @@ static curl_version_info_data version_info = {
NULL,
#endif
0, /* zstd_ver_num */
NULL /* zstd version */
NULL, /* zstd version */
NULL /* Hyper version */
};
curl_version_info_data *curl_version_info(CURLversion stamp)
@ -472,7 +480,6 @@ curl_version_info_data *curl_version_info(CURLversion stamp)
static char zstd_buffer[80];
#endif
#ifdef USE_SSL
Curl_ssl_version(ssl_buffer, sizeof(ssl_buffer));
version_info.ssl_version = ssl_buffer;
@ -547,6 +554,14 @@ curl_version_info_data *curl_version_info(CURLversion stamp)
}
#endif
#ifdef USE_HYPER
{
static char hyper_buffer[30];
msnprintf(hyper_buffer, sizeof(hyper_buffer), "Hyper/%s", hyper_version());
version_info.hyper_version = hyper_buffer;
}
#endif
(void)stamp; /* avoid compiler warnings, we don't use this */
return &version_info;
}