Coverage Report

Created: 2026-07-14 07:09

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