xref: /curl/lib/version.c (revision fb711b50)
1 /***************************************************************************
2  *                                  _   _ ____  _
3  *  Project                     ___| | | |  _ \| |
4  *                             / __| | | | |_) | |
5  *                            | (__| |_| |  _ <| |___
6  *                             \___|\___/|_| \_\_____|
7  *
8  * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9  *
10  * This software is licensed as described in the file COPYING, which
11  * you should have received as part of this distribution. The terms
12  * are also available at https://curl.se/docs/copyright.html.
13  *
14  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15  * copies of the Software, and permit persons to whom the Software is
16  * furnished to do so, under the terms of the COPYING file.
17  *
18  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19  * KIND, either express or implied.
20  *
21  * SPDX-License-Identifier: curl
22  *
23  ***************************************************************************/
24 
25 #include "curl_setup.h"
26 
27 #ifdef USE_NGHTTP2
28 #include <nghttp2/nghttp2.h>
29 #endif
30 
31 #include <curl/curl.h>
32 #include "urldata.h"
33 #include "vtls/vtls.h"
34 #include "http2.h"
35 #include "vssh/ssh.h"
36 #include "vquic/vquic.h"
37 #include "curl_printf.h"
38 #include "easy_lock.h"
39 
40 #ifdef USE_ARES
41 #  if defined(CURL_STATICLIB) && !defined(CARES_STATICLIB) &&   \
42   defined(_WIN32)
43 #    define CARES_STATICLIB
44 #  endif
45 #  include <ares.h>
46 #endif
47 
48 #ifdef USE_LIBIDN2
49 #include <idn2.h>
50 #endif
51 
52 #ifdef USE_LIBPSL
53 #include <libpsl.h>
54 #endif
55 
56 #ifdef USE_LIBRTMP
57 #include <librtmp/rtmp.h>
58 #include "curl_rtmp.h"
59 #endif
60 
61 #ifdef HAVE_LIBZ
62 #include <zlib.h>
63 #endif
64 
65 #ifdef HAVE_BROTLI
66 #if defined(__GNUC__) || defined(__clang__)
67 /* Ignore -Wvla warnings in brotli headers */
68 #pragma GCC diagnostic push
69 #pragma GCC diagnostic ignored "-Wvla"
70 #endif
71 #include <brotli/decode.h>
72 #if defined(__GNUC__) || defined(__clang__)
73 #pragma GCC diagnostic pop
74 #endif
75 #endif
76 
77 #ifdef HAVE_ZSTD
78 #include <zstd.h>
79 #endif
80 
81 #ifdef USE_GSASL
82 #include <gsasl.h>
83 #endif
84 
85 #ifdef USE_OPENLDAP
86 #include <ldap.h>
87 #endif
88 
89 #ifdef HAVE_BROTLI
brotli_version(char * buf,size_t bufsz)90 static void brotli_version(char *buf, size_t bufsz)
91 {
92   uint32_t brotli_version = BrotliDecoderVersion();
93   unsigned int major = brotli_version >> 24;
94   unsigned int minor = (brotli_version & 0x00FFFFFF) >> 12;
95   unsigned int patch = brotli_version & 0x00000FFF;
96   (void)msnprintf(buf, bufsz, "brotli/%u.%u.%u", major, minor, patch);
97 }
98 #endif
99 
100 #ifdef HAVE_ZSTD
zstd_version(char * buf,size_t bufsz)101 static void zstd_version(char *buf, size_t bufsz)
102 {
103   unsigned int version = ZSTD_versionNumber();
104   unsigned int major = version / (100 * 100);
105   unsigned int minor = (version - (major * 100 * 100)) / 100;
106   unsigned int patch = version - (major * 100 * 100) - (minor * 100);
107   (void)msnprintf(buf, bufsz, "zstd/%u.%u.%u", major, minor, patch);
108 }
109 #endif
110 
111 #ifdef USE_OPENLDAP
oldap_version(char * buf,size_t bufsz)112 static void oldap_version(char *buf, size_t bufsz)
113 {
114   LDAPAPIInfo api;
115   api.ldapai_info_version = LDAP_API_INFO_VERSION;
116 
117   if(ldap_get_option(NULL, LDAP_OPT_API_INFO, &api) == LDAP_OPT_SUCCESS) {
118     unsigned int patch = (unsigned int)(api.ldapai_vendor_version % 100);
119     unsigned int major = (unsigned int)(api.ldapai_vendor_version / 10000);
120     unsigned int minor =
121       (((unsigned int)api.ldapai_vendor_version - major * 10000)
122        - patch) / 100;
123     msnprintf(buf, bufsz, "%s/%u.%u.%u",
124               api.ldapai_vendor_name, major, minor, patch);
125     ldap_memfree(api.ldapai_vendor_name);
126     ber_memvfree((void **)api.ldapai_extensions);
127   }
128   else
129     msnprintf(buf, bufsz, "OpenLDAP");
130 }
131 #endif
132 
133 #ifdef USE_LIBPSL
psl_version(char * buf,size_t bufsz)134 static void psl_version(char *buf, size_t bufsz)
135 {
136 #if defined(PSL_VERSION_MAJOR) && (PSL_VERSION_MAJOR > 0 ||     \
137                                    PSL_VERSION_MINOR >= 11)
138   int num = psl_check_version_number(0);
139   msnprintf(buf, bufsz, "libpsl/%d.%d.%d",
140             num >> 16, (num >> 8) & 0xff, num & 0xff);
141 #else
142   msnprintf(buf, bufsz, "libpsl/%s", psl_get_version());
143 #endif
144 }
145 #endif
146 
147 #if defined(USE_LIBIDN2) || defined(USE_WIN32_IDN) || defined(USE_APPLE_IDN)
148 #define USE_IDN
149 #endif
150 
151 #ifdef USE_IDN
idn_version(char * buf,size_t bufsz)152 static void idn_version(char *buf, size_t bufsz)
153 {
154 #ifdef USE_LIBIDN2
155   msnprintf(buf, bufsz, "libidn2/%s", idn2_check_version(NULL));
156 #elif defined(USE_WIN32_IDN)
157   msnprintf(buf, bufsz, "WinIDN");
158 #elif defined(USE_APPLE_IDN)
159   msnprintf(buf, bufsz, "AppleIDN");
160 #endif
161 }
162 #endif
163 
164 /*
165  * curl_version() returns a pointer to a static buffer.
166  *
167  * It is implemented to work multi-threaded by making sure repeated invokes
168  * generate the exact same string and never write any temporary data like
169  * zeros in the data.
170  */
171 
172 #define VERSION_PARTS 16 /* number of substrings we can concatenate */
173 
curl_version(void)174 char *curl_version(void)
175 {
176   static char out[300];
177   char *outp;
178   size_t outlen;
179   const char *src[VERSION_PARTS];
180 #ifdef USE_SSL
181   char ssl_version[200];
182 #endif
183 #ifdef HAVE_LIBZ
184   char z_version[30];
185 #endif
186 #ifdef HAVE_BROTLI
187   char br_version[30];
188 #endif
189 #ifdef HAVE_ZSTD
190   char zstd_ver[30];
191 #endif
192 #ifdef USE_ARES
193   char cares_version[30];
194 #endif
195 #ifdef USE_IDN
196   char idn_ver[30];
197 #endif
198 #ifdef USE_LIBPSL
199   char psl_ver[30];
200 #endif
201 #ifdef USE_SSH
202   char ssh_version[30];
203 #endif
204 #ifdef USE_NGHTTP2
205   char h2_version[30];
206 #endif
207 #ifdef USE_HTTP3
208   char h3_version[30];
209 #endif
210 #ifdef USE_LIBRTMP
211   char rtmp_version[30];
212 #endif
213 #ifdef USE_HYPER
214   char hyper_buf[30];
215 #endif
216 #ifdef USE_GSASL
217   char gsasl_buf[30];
218 #endif
219 #ifdef USE_OPENLDAP
220   char ldap_buf[30];
221 #endif
222   int i = 0;
223   int j;
224 
225 #ifdef DEBUGBUILD
226   /* Override version string when environment variable CURL_VERSION is set */
227   const char *debugversion = getenv("CURL_VERSION");
228   if(debugversion) {
229     msnprintf(out, sizeof(out), "%s", debugversion);
230     return out;
231   }
232 #endif
233 
234   src[i++] = LIBCURL_NAME "/" LIBCURL_VERSION;
235 #ifdef USE_SSL
236   Curl_ssl_version(ssl_version, sizeof(ssl_version));
237   src[i++] = ssl_version;
238 #endif
239 #ifdef HAVE_LIBZ
240   msnprintf(z_version, sizeof(z_version), "zlib/%s", zlibVersion());
241   src[i++] = z_version;
242 #endif
243 #ifdef HAVE_BROTLI
244   brotli_version(br_version, sizeof(br_version));
245   src[i++] = br_version;
246 #endif
247 #ifdef HAVE_ZSTD
248   zstd_version(zstd_ver, sizeof(zstd_ver));
249   src[i++] = zstd_ver;
250 #endif
251 #ifdef USE_ARES
252   msnprintf(cares_version, sizeof(cares_version),
253             "c-ares/%s", ares_version(NULL));
254   src[i++] = cares_version;
255 #endif
256 #ifdef USE_IDN
257   idn_version(idn_ver, sizeof(idn_ver));
258   src[i++] = idn_ver;
259 #endif
260 #ifdef USE_LIBPSL
261   psl_version(psl_ver, sizeof(psl_ver));
262   src[i++] = psl_ver;
263 #endif
264 #ifdef USE_SSH
265   Curl_ssh_version(ssh_version, sizeof(ssh_version));
266   src[i++] = ssh_version;
267 #endif
268 #ifdef USE_NGHTTP2
269   Curl_http2_ver(h2_version, sizeof(h2_version));
270   src[i++] = h2_version;
271 #endif
272 #ifdef USE_HTTP3
273   Curl_quic_ver(h3_version, sizeof(h3_version));
274   src[i++] = h3_version;
275 #endif
276 #ifdef USE_LIBRTMP
277   Curl_rtmp_version(rtmp_version, sizeof(rtmp_version));
278   src[i++] = rtmp_version;
279 #endif
280 #ifdef USE_HYPER
281   msnprintf(hyper_buf, sizeof(hyper_buf), "Hyper/%s", hyper_version());
282   src[i++] = hyper_buf;
283 #endif
284 #ifdef USE_GSASL
285   msnprintf(gsasl_buf, sizeof(gsasl_buf), "libgsasl/%s",
286             gsasl_check_version(NULL));
287   src[i++] = gsasl_buf;
288 #endif
289 #ifdef USE_OPENLDAP
290   oldap_version(ldap_buf, sizeof(ldap_buf));
291   src[i++] = ldap_buf;
292 #endif
293 
294   DEBUGASSERT(i <= VERSION_PARTS);
295 
296   outp = &out[0];
297   outlen = sizeof(out);
298   for(j = 0; j < i; j++) {
299     size_t n = strlen(src[j]);
300     /* we need room for a space, the string and the final zero */
301     if(outlen <= (n + 2))
302       break;
303     if(j) {
304       /* prepend a space if not the first */
305       *outp++ = ' ';
306       outlen--;
307     }
308     memcpy(outp, src[j], n);
309     outp += n;
310     outlen -= n;
311   }
312   *outp = 0;
313 
314   return out;
315 }
316 
317 /* data for curl_version_info
318 
319    Keep the list sorted alphabetically. It is also written so that each
320    protocol line has its own #if line to make things easier on the eye.
321  */
322 
323 static const char * const supported_protocols[] = {
324 #ifndef CURL_DISABLE_DICT
325   "dict",
326 #endif
327 #ifndef CURL_DISABLE_FILE
328   "file",
329 #endif
330 #ifndef CURL_DISABLE_FTP
331   "ftp",
332 #endif
333 #if defined(USE_SSL) && !defined(CURL_DISABLE_FTP)
334   "ftps",
335 #endif
336 #ifndef CURL_DISABLE_GOPHER
337   "gopher",
338 #endif
339 #if defined(USE_SSL) && !defined(CURL_DISABLE_GOPHER)
340   "gophers",
341 #endif
342 #ifndef CURL_DISABLE_HTTP
343   "http",
344 #endif
345 #if defined(USE_SSL) && !defined(CURL_DISABLE_HTTP)
346   "https",
347 #endif
348 #ifndef CURL_DISABLE_IMAP
349   "imap",
350 #endif
351 #if defined(USE_SSL) && !defined(CURL_DISABLE_IMAP)
352   "imaps",
353 #endif
354 #ifndef CURL_DISABLE_LDAP
355   "ldap",
356 #if !defined(CURL_DISABLE_LDAPS) && \
357     ((defined(USE_OPENLDAP) && defined(USE_SSL)) || \
358      (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL)))
359   "ldaps",
360 #endif
361 #endif
362 #ifndef CURL_DISABLE_MQTT
363   "mqtt",
364 #endif
365 #ifndef CURL_DISABLE_POP3
366   "pop3",
367 #endif
368 #if defined(USE_SSL) && !defined(CURL_DISABLE_POP3)
369   "pop3s",
370 #endif
371 #ifdef USE_LIBRTMP
372   "rtmp",
373   "rtmpe",
374   "rtmps",
375   "rtmpt",
376   "rtmpte",
377   "rtmpts",
378 #endif
379 #ifndef CURL_DISABLE_RTSP
380   "rtsp",
381 #endif
382 #if defined(USE_SSH) && !defined(USE_WOLFSSH)
383   "scp",
384 #endif
385 #ifdef USE_SSH
386   "sftp",
387 #endif
388 #if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE)
389   "smb",
390 #  ifdef USE_SSL
391   "smbs",
392 #  endif
393 #endif
394 #ifndef CURL_DISABLE_SMTP
395   "smtp",
396 #endif
397 #if defined(USE_SSL) && !defined(CURL_DISABLE_SMTP)
398   "smtps",
399 #endif
400 #ifndef CURL_DISABLE_TELNET
401   "telnet",
402 #endif
403 #ifndef CURL_DISABLE_TFTP
404   "tftp",
405 #endif
406 #ifndef CURL_DISABLE_HTTP
407   /* WebSocket support relies on HTTP */
408 #ifndef CURL_DISABLE_WEBSOCKETS
409   "ws",
410 #endif
411 #if defined(USE_SSL) && !defined(CURL_DISABLE_WEBSOCKETS)
412   "wss",
413 #endif
414 #endif
415 
416   NULL
417 };
418 
419 /*
420  * Feature presence runtime check functions.
421  *
422  * Warning: the value returned by these should not change between
423  * curl_global_init() and curl_global_cleanup() calls.
424  */
425 
426 #if defined(USE_LIBIDN2)
idn_present(curl_version_info_data * info)427 static int idn_present(curl_version_info_data *info)
428 {
429   return info->libidn != NULL;
430 }
431 #else
432 #define idn_present     NULL
433 #endif
434 
435 #if defined(USE_SSL) && !defined(CURL_DISABLE_PROXY) && \
436   !defined(CURL_DISABLE_HTTP)
https_proxy_present(curl_version_info_data * info)437 static int https_proxy_present(curl_version_info_data *info)
438 {
439   (void) info;
440   return Curl_ssl_supports(NULL, SSLSUPP_HTTPS_PROXY);
441 }
442 #endif
443 
444 #if defined(USE_SSL) && defined(USE_ECH)
ech_present(curl_version_info_data * info)445 static int ech_present(curl_version_info_data *info)
446 {
447   (void) info;
448   return Curl_ssl_supports(NULL, SSLSUPP_ECH);
449 }
450 #endif
451 
452 /*
453  * Features table.
454  *
455  * Keep the features alphabetically sorted.
456  * Use FEATURE() macro to define an entry: this allows documentation check.
457  */
458 
459 #define FEATURE(name, present, bitmask) {(name), (present), (bitmask)}
460 
461 struct feat {
462   const char *name;
463   int        (*present)(curl_version_info_data *info);
464   int        bitmask;
465 };
466 
467 static const struct feat features_table[] = {
468 #ifndef CURL_DISABLE_ALTSVC
469   FEATURE("alt-svc",     NULL,                CURL_VERSION_ALTSVC),
470 #endif
471 #ifdef CURLRES_ASYNCH
472   FEATURE("AsynchDNS",   NULL,                CURL_VERSION_ASYNCHDNS),
473 #endif
474 #ifdef HAVE_BROTLI
475   FEATURE("brotli",      NULL,                CURL_VERSION_BROTLI),
476 #endif
477 #ifdef DEBUGBUILD
478   FEATURE("Debug",       NULL,                CURL_VERSION_DEBUG),
479 #endif
480 #if defined(USE_SSL) && defined(USE_ECH)
481   FEATURE("ECH",         ech_present,         0),
482 #endif
483 #ifdef USE_GSASL
484   FEATURE("gsasl",       NULL,                CURL_VERSION_GSASL),
485 #endif
486 #ifdef HAVE_GSSAPI
487   FEATURE("GSS-API",     NULL,                CURL_VERSION_GSSAPI),
488 #endif
489 #ifndef CURL_DISABLE_HSTS
490   FEATURE("HSTS",        NULL,                CURL_VERSION_HSTS),
491 #endif
492 #if defined(USE_NGHTTP2)
493   FEATURE("HTTP2",       NULL,                CURL_VERSION_HTTP2),
494 #endif
495 #if defined(USE_HTTP3)
496   FEATURE("HTTP3",       NULL,                CURL_VERSION_HTTP3),
497 #endif
498 #if defined(USE_SSL) && !defined(CURL_DISABLE_PROXY) && \
499   !defined(CURL_DISABLE_HTTP)
500   FEATURE("HTTPS-proxy", https_proxy_present, CURL_VERSION_HTTPS_PROXY),
501 #endif
502 #if defined(USE_LIBIDN2) || defined(USE_WIN32_IDN) || defined(USE_APPLE_IDN)
503   FEATURE("IDN",         idn_present,         CURL_VERSION_IDN),
504 #endif
505 #ifdef USE_IPV6
506   FEATURE("IPv6",        NULL,                CURL_VERSION_IPV6),
507 #endif
508 #ifdef USE_KERBEROS5
509   FEATURE("Kerberos",    NULL,                CURL_VERSION_KERBEROS5),
510 #endif
511 #if (SIZEOF_CURL_OFF_T > 4) && \
512     ( (SIZEOF_OFF_T > 4) || defined(USE_WIN32_LARGE_FILES) )
513   FEATURE("Largefile",   NULL,                CURL_VERSION_LARGEFILE),
514 #endif
515 #ifdef HAVE_LIBZ
516   FEATURE("libz",        NULL,                CURL_VERSION_LIBZ),
517 #endif
518 #ifdef CURL_WITH_MULTI_SSL
519   FEATURE("MultiSSL",    NULL,                CURL_VERSION_MULTI_SSL),
520 #endif
521 #ifdef USE_NTLM
522   FEATURE("NTLM",        NULL,                CURL_VERSION_NTLM),
523 #endif
524 #if defined(USE_LIBPSL)
525   FEATURE("PSL",         NULL,                CURL_VERSION_PSL),
526 #endif
527 #ifdef USE_SPNEGO
528   FEATURE("SPNEGO",      NULL,                CURL_VERSION_SPNEGO),
529 #endif
530 #ifdef USE_SSL
531   FEATURE("SSL",         NULL,                CURL_VERSION_SSL),
532 #endif
533 #ifdef USE_WINDOWS_SSPI
534   FEATURE("SSPI",        NULL,                CURL_VERSION_SSPI),
535 #endif
536 #ifdef GLOBAL_INIT_IS_THREADSAFE
537   FEATURE("threadsafe",  NULL,                CURL_VERSION_THREADSAFE),
538 #endif
539 #ifdef USE_TLS_SRP
540   FEATURE("TLS-SRP",     NULL,                CURL_VERSION_TLSAUTH_SRP),
541 #endif
542 #ifdef CURLDEBUG
543   FEATURE("TrackMemory", NULL,                CURL_VERSION_CURLDEBUG),
544 #endif
545 #if defined(_WIN32) && defined(UNICODE) && defined(_UNICODE)
546   FEATURE("Unicode",     NULL,                CURL_VERSION_UNICODE),
547 #endif
548 #ifdef USE_UNIX_SOCKETS
549   FEATURE("UnixSockets", NULL,                CURL_VERSION_UNIX_SOCKETS),
550 #endif
551 #ifdef HAVE_ZSTD
552   FEATURE("zstd",        NULL,                CURL_VERSION_ZSTD),
553 #endif
554   {NULL,             NULL,                0}
555 };
556 
557 static const char *feature_names[sizeof(features_table) /
558                                  sizeof(features_table[0])] = {NULL};
559 
560 
561 static curl_version_info_data version_info = {
562   CURLVERSION_NOW,
563   LIBCURL_VERSION,
564   LIBCURL_VERSION_NUM,
565   CURL_OS, /* as found by configure or set by hand at build-time */
566   0,    /* features bitmask is built at runtime */
567   NULL, /* ssl_version */
568   0,    /* ssl_version_num, this is kept at zero */
569   NULL, /* zlib_version */
570   supported_protocols,
571   NULL, /* c-ares version */
572   0,    /* c-ares version numerical */
573   NULL, /* libidn version */
574   0,    /* iconv version */
575   NULL, /* ssh lib version */
576   0,    /* brotli_ver_num */
577   NULL, /* brotli version */
578   0,    /* nghttp2 version number */
579   NULL, /* nghttp2 version string */
580   NULL, /* quic library string */
581 #ifdef CURL_CA_BUNDLE
582   CURL_CA_BUNDLE, /* cainfo */
583 #else
584   NULL,
585 #endif
586 #ifdef CURL_CA_PATH
587   CURL_CA_PATH,  /* capath */
588 #else
589   NULL,
590 #endif
591   0,    /* zstd_ver_num */
592   NULL, /* zstd version */
593   NULL, /* Hyper version */
594   NULL, /* gsasl version */
595   feature_names,
596   NULL  /* rtmp version */
597 };
598 
curl_version_info(CURLversion stamp)599 curl_version_info_data *curl_version_info(CURLversion stamp)
600 {
601   size_t n;
602   const struct feat *p;
603   int features = 0;
604 
605 #if defined(USE_SSH)
606   static char ssh_buf[80];  /* 'ssh_buffer' clashes with libssh/libssh.h */
607 #endif
608 #ifdef USE_SSL
609 #ifdef CURL_WITH_MULTI_SSL
610   static char ssl_buffer[200];
611 #else
612   static char ssl_buffer[80];
613 #endif
614 #endif
615 #ifdef HAVE_BROTLI
616   static char brotli_buffer[80];
617 #endif
618 #ifdef HAVE_ZSTD
619   static char zstd_buffer[80];
620 #endif
621 
622   (void)stamp; /* avoid compiler warnings, we do not use this */
623 
624 #ifdef USE_SSL
625   Curl_ssl_version(ssl_buffer, sizeof(ssl_buffer));
626   version_info.ssl_version = ssl_buffer;
627 #endif
628 
629 #ifdef HAVE_LIBZ
630   version_info.libz_version = zlibVersion();
631   /* libz left NULL if non-existing */
632 #endif
633 #ifdef USE_ARES
634   {
635     int aresnum;
636     version_info.ares = ares_version(&aresnum);
637     version_info.ares_num = aresnum;
638   }
639 #endif
640 #ifdef USE_LIBIDN2
641   /* This returns a version string if we use the given version or later,
642      otherwise it returns NULL */
643   version_info.libidn = idn2_check_version(IDN2_VERSION);
644 #endif
645 
646 #if defined(USE_SSH)
647   Curl_ssh_version(ssh_buf, sizeof(ssh_buf));
648   version_info.libssh_version = ssh_buf;
649 #endif
650 
651 #ifdef HAVE_BROTLI
652   version_info.brotli_ver_num = BrotliDecoderVersion();
653   brotli_version(brotli_buffer, sizeof(brotli_buffer));
654   version_info.brotli_version = brotli_buffer;
655 #endif
656 
657 #ifdef HAVE_ZSTD
658   version_info.zstd_ver_num = (unsigned int)ZSTD_versionNumber();
659   zstd_version(zstd_buffer, sizeof(zstd_buffer));
660   version_info.zstd_version = zstd_buffer;
661 #endif
662 
663 #ifdef USE_NGHTTP2
664   {
665     nghttp2_info *h2 = nghttp2_version(0);
666     version_info.nghttp2_ver_num = (unsigned int)h2->version_num;
667     version_info.nghttp2_version = h2->version_str;
668   }
669 #endif
670 
671 #ifdef USE_HTTP3
672   {
673     static char quicbuffer[80];
674     Curl_quic_ver(quicbuffer, sizeof(quicbuffer));
675     version_info.quic_version = quicbuffer;
676   }
677 #endif
678 
679 #ifdef USE_HYPER
680   {
681     static char hyper_buffer[30];
682     msnprintf(hyper_buffer, sizeof(hyper_buffer), "Hyper/%s", hyper_version());
683     version_info.hyper_version = hyper_buffer;
684   }
685 #endif
686 
687 #ifdef USE_GSASL
688   {
689     version_info.gsasl_version = gsasl_check_version(NULL);
690   }
691 #endif
692 
693   /* Get available features, build bitmask and names array. */
694   n = 0;
695   for(p = features_table; p->name; p++)
696     if(!p->present || p->present(&version_info)) {
697       features |= p->bitmask;
698       feature_names[n++] = p->name;
699     }
700 
701   feature_names[n] = NULL;  /* Terminate array. */
702   version_info.features = features;
703 
704 #ifdef USE_LIBRTMP
705   {
706     static char rtmp_version[30];
707     Curl_rtmp_version(rtmp_version, sizeof(rtmp_version));
708     version_info.rtmp_version = rtmp_version;
709   }
710 #endif
711 
712   return &version_info;
713 }
714