Coverage Report

Created: 2026-09-14 07:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/curl/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 <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
0
{
80
0
  uint32_t brotli_version = BrotliDecoderVersion();
81
0
  unsigned int major = brotli_version >> 24;
82
0
  unsigned int minor = (brotli_version & 0x00FFFFFF) >> 12;
83
0
  unsigned int patch = brotli_version & 0x00000FFF;
84
0
  (void)curl_msnprintf(buf, bufsz, "brotli/%u.%u.%u", major, minor, patch);
85
0
}
86
#endif
87
88
#ifdef HAVE_ZSTD
89
static void zstd_version(char *buf, size_t bufsz)
90
0
{
91
0
  unsigned int version = ZSTD_versionNumber();
92
0
  unsigned int major = version / (100 * 100);
93
0
  unsigned int minor = (version - (major * 100 * 100)) / 100;
94
0
  unsigned int patch = version - (major * 100 * 100) - (minor * 100);
95
0
  (void)curl_msnprintf(buf, bufsz, "zstd/%u.%u.%u", major, minor, patch);
96
0
}
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
0
{
120
0
#ifdef USE_LIBIDN2
121
0
  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
0
}
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
0
#ifdef USE_SSL
147
0
  char ssl_version[200];
148
0
#endif
149
0
#ifdef HAVE_LIBZ
150
0
  char z_version[30];
151
0
#endif
152
0
#ifdef HAVE_BROTLI
153
0
  char br_version[30];
154
0
#endif
155
0
#ifdef HAVE_ZSTD
156
0
  char zstd_ver[30];
157
0
#endif
158
#ifdef USE_ARES
159
  char cares_version[30];
160
#endif
161
0
#ifdef USE_IDN
162
0
  char idn_ver[30];
163
0
#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
0
#ifndef CURL_DISABLE_LDAP
183
0
  char ldap_buf[30];
184
0
#endif
185
0
  int i = 0;
186
0
  int j;
187
188
0
#ifdef DEBUGBUILD
189
  /* Override version string when environment variable CURL_VERSION is set */
190
0
  const char *debugversion = getenv("CURL_VERSION");
191
0
  if(debugversion) {
192
0
    curl_msnprintf(out, sizeof(out), "%s", debugversion);
193
0
    return out;
194
0
  }
195
0
#endif
196
197
0
  src[i++] = LIBCURL_NAME "/" LIBCURL_VERSION;
198
0
#ifdef USE_SSL
199
0
  Curl_ssl_version(ssl_version, sizeof(ssl_version));
200
0
  src[i++] = ssl_version;
201
0
#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
0
#ifdef HAVE_BROTLI
207
0
  brotli_version(br_version, sizeof(br_version));
208
0
  src[i++] = br_version;
209
0
#endif
210
0
#ifdef HAVE_ZSTD
211
0
  zstd_version(zstd_ver, sizeof(zstd_ver));
212
0
  src[i++] = zstd_ver;
213
0
#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
0
#ifdef USE_IDN
220
0
  idn_version(idn_ver, sizeof(idn_ver));
221
0
  src[i++] = idn_ver;
222
0
#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_GSSAPPLE
246
  curl_msnprintf(gss_buf, sizeof(gss_buf), "AppleGSS");
247
#elif defined(HAVE_GSSGNU)
248
  curl_msnprintf(gss_buf, sizeof(gss_buf), "libgss/%s", GSS_VERSION);
249
#elif defined(CURL_KRB5_VERSION)
250
  curl_msnprintf(gss_buf, sizeof(gss_buf), "mit-krb5/%s", CURL_KRB5_VERSION);
251
#else
252
  curl_msnprintf(gss_buf, sizeof(gss_buf), "mit-krb5");
253
#endif
254
  src[i++] = gss_buf;
255
#endif /* HAVE_GSSAPI */
256
0
#ifndef CURL_DISABLE_LDAP
257
0
  Curl_ldap_version(ldap_buf, sizeof(ldap_buf));
258
0
  src[i++] = ldap_buf;
259
0
#endif
260
261
0
  DEBUGASSERT(i <= VERSION_PARTS);
262
263
0
  outp = &out[0];
264
0
  outlen = sizeof(out);
265
0
  for(j = 0; j < i; j++) {
266
0
    size_t n = strlen(src[j]);
267
    /* we need room for a space, the string and the final zero */
268
0
    if(outlen <= (n + 2))
269
0
      break;
270
0
    if(j) {
271
      /* prepend a space if not the first */
272
0
      *outp++ = ' ';
273
0
      outlen--;
274
0
    }
275
0
    memcpy(outp, src[j], n);
276
0
    outp += n;
277
0
    outlen -= n;
278
0
  }
279
0
  *outp = 0;
280
281
0
  return out;
282
0
}
283
284
/* data for curl_version_info
285
286
   Keep the list sorted alphabetically. It is also written so that each
287
   protocol line has its own #if line to make things easier on the eye.
288
 */
289
290
static const char * const supported_protocols[] = {
291
#ifndef CURL_DISABLE_DICT
292
  "dict",
293
#endif
294
#ifndef CURL_DISABLE_FILE
295
  "file",
296
#endif
297
#ifndef CURL_DISABLE_FTP
298
  "ftp",
299
#endif
300
#if defined(USE_SSL) && !defined(CURL_DISABLE_FTP)
301
  "ftps",
302
#endif
303
#ifndef CURL_DISABLE_GOPHER
304
  "gopher",
305
#endif
306
#if defined(USE_SSL) && !defined(CURL_DISABLE_GOPHER)
307
  "gophers",
308
#endif
309
#ifndef CURL_DISABLE_HTTP
310
  "http",
311
#endif
312
#if defined(USE_SSL) && !defined(CURL_DISABLE_HTTP)
313
  "https",
314
#endif
315
#ifndef CURL_DISABLE_IMAP
316
  "imap",
317
#endif
318
#if defined(USE_SSL) && !defined(CURL_DISABLE_IMAP)
319
  "imaps",
320
#endif
321
#ifndef CURL_DISABLE_LDAP
322
  "ldap",
323
#if !defined(CURL_DISABLE_LDAPS) && \
324
  ((defined(USE_OPENLDAP) && defined(USE_SSL)) || \
325
   (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL)))
326
  "ldaps",
327
#endif
328
#endif
329
#ifndef CURL_DISABLE_MQTT
330
  "mqtt",
331
#endif
332
#if defined(USE_SSL) && !defined(CURL_DISABLE_MQTT)
333
  "mqtts",
334
#endif
335
#ifndef CURL_DISABLE_POP3
336
  "pop3",
337
#endif
338
#if defined(USE_SSL) && !defined(CURL_DISABLE_POP3)
339
  "pop3s",
340
#endif
341
#ifndef CURL_DISABLE_RTSP
342
  "rtsp",
343
#endif
344
#ifdef USE_SSH
345
  "scp",
346
  "sftp",
347
#endif
348
#ifndef CURL_DISABLE_SMTP
349
  "smtp",
350
#endif
351
#if defined(USE_SSL) && !defined(CURL_DISABLE_SMTP)
352
  "smtps",
353
#endif
354
#ifndef CURL_DISABLE_TELNET
355
  "telnet",
356
#endif
357
#ifndef CURL_DISABLE_TFTP
358
  "tftp",
359
#endif
360
#ifndef CURL_DISABLE_HTTP
361
  /* WebSocket support relies on HTTP */
362
#ifndef CURL_DISABLE_WEBSOCKETS
363
  "ws",
364
#endif
365
#if defined(USE_SSL) && !defined(CURL_DISABLE_WEBSOCKETS)
366
  "wss",
367
#endif
368
#endif
369
370
  NULL
371
};
372
373
/*
374
 * Feature presence runtime check functions.
375
 *
376
 * Warning: the value returned by these should not change between
377
 * curl_global_init() and curl_global_cleanup() calls.
378
 */
379
380
#if defined(USE_LIBIDN2) || defined(USE_WIN32_IDN) || defined(USE_APPLE_IDN)
381
static int idn_present(curl_version_info_data *info)
382
0
{
383
#if defined(USE_WIN32_IDN) || defined(USE_APPLE_IDN)
384
  (void)info;
385
  return TRUE;
386
#else
387
0
  return !!info->libidn;
388
0
#endif
389
0
}
390
#endif
391
392
#if defined(USE_SSL) && !defined(CURL_DISABLE_PROXY) && \
393
  !defined(CURL_DISABLE_HTTP)
394
static int https_proxy_present(curl_version_info_data *info)
395
0
{
396
0
  (void)info;
397
0
  return Curl_ssl_supports(NULL, SSLSUPP_HTTPS_PROXY);
398
0
}
399
#endif
400
401
#if defined(USE_SSL) && defined(USE_ECH)
402
static int ech_present(curl_version_info_data *info)
403
0
{
404
0
  (void)info;
405
0
  return Curl_ssl_supports(NULL, SSLSUPP_ECH);
406
0
}
407
#endif
408
409
/*
410
 * Features table.
411
 *
412
 * Keep the features alphabetically sorted.
413
 * Use FEATURE() macro to define an entry: this allows documentation check.
414
 */
415
416
#define FEATURE(name, present, bitmask) { (name), (present), (bitmask) }
417
418
struct feat {
419
  const char *name;
420
  int        (*present)(curl_version_info_data *info);
421
  int        bitmask;
422
};
423
424
static const struct feat features_table[] = {
425
#ifndef CURL_DISABLE_ALTSVC
426
  FEATURE("alt-svc",     NULL,                CURL_VERSION_ALTSVC),
427
#endif
428
#if defined(USE_ARES) && defined(USE_RESOLV_THREADED) && defined(USE_HTTPSRR)
429
  FEATURE("asyn-rr",     NULL,                0),
430
#endif
431
#ifdef CURLRES_ASYNCH
432
  FEATURE("AsynchDNS",   NULL,                CURL_VERSION_ASYNCHDNS),
433
#endif
434
#ifdef HAVE_BROTLI
435
  FEATURE("brotli",      NULL,                CURL_VERSION_BROTLI),
436
#endif
437
#ifdef DEBUGBUILD
438
  FEATURE("Debug",       NULL,                CURL_VERSION_DEBUG),
439
#endif
440
#if defined(USE_SSL) && defined(USE_ECH)
441
  FEATURE("ECH",         ech_present,         0),
442
443
#ifndef USE_HTTPSRR
444
#error "ECH enabled but not HTTPSRR, must be a config error"
445
#endif
446
#endif
447
#ifdef USE_GSASL
448
  FEATURE("gsasl",       NULL,                CURL_VERSION_GSASL),
449
#endif
450
#ifdef HAVE_GSSAPI
451
  FEATURE("GSS-API",     NULL,                CURL_VERSION_GSSAPI),
452
#endif
453
#ifndef CURL_DISABLE_HSTS
454
  FEATURE("HSTS",        NULL,                CURL_VERSION_HSTS),
455
#endif
456
#if !defined(CURL_DISABLE_HTTP) && defined(USE_NGHTTP2)
457
  FEATURE("HTTP2",       NULL,                CURL_VERSION_HTTP2),
458
#endif
459
#if !defined(CURL_DISABLE_HTTP) && defined(USE_HTTP3)
460
  FEATURE("HTTP3",       NULL,                CURL_VERSION_HTTP3),
461
#endif
462
#if defined(USE_SSL) && !defined(CURL_DISABLE_PROXY) && \
463
  !defined(CURL_DISABLE_HTTP)
464
  FEATURE("HTTPS-proxy", https_proxy_present, CURL_VERSION_HTTPS_PROXY),
465
#endif
466
#ifndef CURL_DISABLE_HTTPSIG
467
  FEATURE("HTTPSIG",     NULL,                0),
468
#endif
469
#ifdef USE_HTTPSRR
470
  FEATURE("HTTPSRR",     NULL,                0),
471
#endif
472
#if defined(USE_LIBIDN2) || defined(USE_WIN32_IDN) || defined(USE_APPLE_IDN)
473
  FEATURE("IDN",         idn_present,         CURL_VERSION_IDN),
474
#endif
475
#ifdef USE_IPV6
476
  FEATURE("IPv6",        NULL,                CURL_VERSION_IPV6),
477
#endif
478
#ifdef USE_KERBEROS5
479
  FEATURE("Kerberos",    NULL,                CURL_VERSION_KERBEROS5),
480
#endif
481
#if (SIZEOF_CURL_OFF_T > 4) && ((SIZEOF_OFF_T > 4) || defined(_WIN32))
482
  FEATURE("Largefile",   NULL,                CURL_VERSION_LARGEFILE),
483
#endif
484
#ifdef HAVE_LIBZ
485
  FEATURE("libz",        NULL,                CURL_VERSION_LIBZ),
486
#endif
487
#ifdef CURL_WITH_MULTI_SSL
488
  FEATURE("MultiSSL",    NULL,                CURL_VERSION_MULTI_SSL),
489
#endif
490
#ifdef USE_NTLM
491
  FEATURE("NTLM",        NULL,                CURL_VERSION_NTLM),
492
#endif
493
#ifdef USE_PROXY_HTTP3
494
  FEATURE("proxy-HTTP3", NULL,                0),
495
#endif
496
#ifdef USE_LIBPSL
497
  FEATURE("PSL",         NULL,                CURL_VERSION_PSL),
498
#endif
499
#ifdef USE_SSL
500
#ifdef USE_APPLE_SECTRUST
501
  FEATURE("AppleSecTrust", NULL,              0),
502
#elif defined(CURL_CA_NATIVE)
503
  FEATURE("NativeCA",    NULL,              0),
504
#endif
505
#endif /* USE_SSL */
506
#ifdef USE_SPNEGO
507
  FEATURE("SPNEGO",      NULL,                CURL_VERSION_SPNEGO),
508
#endif
509
#ifdef USE_SSL
510
  FEATURE("SSL",         NULL,                CURL_VERSION_SSL),
511
#endif
512
#ifdef USE_SSLS_EXPORT
513
  FEATURE("SSLS-EXPORT", NULL,                0),
514
#endif
515
#ifdef USE_WINDOWS_SSPI
516
  FEATURE("SSPI",        NULL,                CURL_VERSION_SSPI),
517
#endif
518
#ifdef GLOBAL_INIT_IS_THREADSAFE
519
  FEATURE("threadsafe",  NULL,                CURL_VERSION_THREADSAFE),
520
#endif
521
#if defined(_WIN32) && defined(UNICODE) && defined(_UNICODE)
522
  FEATURE("Unicode",     NULL,                CURL_VERSION_UNICODE),
523
#endif
524
#ifdef USE_UNIX_SOCKETS
525
  FEATURE("UnixSockets", NULL,                CURL_VERSION_UNIX_SOCKETS),
526
#endif
527
#ifdef HAVE_ZSTD
528
  FEATURE("zstd",        NULL,                CURL_VERSION_ZSTD),
529
#endif
530
  {NULL,                 NULL,                0}
531
};
532
533
static const char *feature_names[CURL_ARRAYSIZE(features_table)] = { NULL };
534
535
static curl_version_info_data version_info = {
536
  CURLVERSION_NOW,
537
  LIBCURL_VERSION,
538
  LIBCURL_VERSION_NUM,
539
  CURL_OS, /* as found by configure or set by hand at build-time */
540
  0,    /* features bitmask is built at runtime */
541
  NULL, /* ssl_version */
542
  0,    /* ssl_version_num, this is kept at zero */
543
  NULL, /* zlib_version */
544
  supported_protocols,
545
  NULL, /* c-ares version */
546
  0,    /* c-ares version numerical */
547
  NULL, /* libidn version */
548
  0,    /* iconv version */
549
  NULL, /* ssh lib version */
550
  0,    /* brotli_ver_num */
551
  NULL, /* brotli version */
552
  0,    /* nghttp2 version number */
553
  NULL, /* nghttp2 version string */
554
  NULL, /* quic library string */
555
#ifdef CURL_CA_BUNDLE
556
  CURL_CA_BUNDLE, /* cainfo */
557
#else
558
  NULL,
559
#endif
560
#ifdef CURL_CA_PATH
561
  CURL_CA_PATH,  /* capath */
562
#else
563
  NULL,
564
#endif
565
  0,    /* zstd_ver_num */
566
  NULL, /* zstd version */
567
  NULL, /* Hyper version */
568
  NULL, /* gsasl version */
569
  feature_names,
570
  NULL  /* rtmp version */
571
};
572
573
curl_version_info_data *curl_version_info(CURLversion stamp)
574
0
{
575
0
  size_t n;
576
0
  const struct feat *p;
577
0
  int features = 0;
578
579
#ifdef USE_SSH
580
  static char ssh_buf[80];  /* 'ssh_buffer' clashes with libssh/libssh.h */
581
#endif
582
0
#ifdef USE_SSL
583
#ifdef CURL_WITH_MULTI_SSL
584
  static char ssl_buffer[200];
585
#else
586
0
  static char ssl_buffer[80];
587
0
#endif
588
0
#endif
589
0
#ifdef HAVE_BROTLI
590
0
  static char brotli_buffer[80];
591
0
#endif
592
0
#ifdef HAVE_ZSTD
593
0
  static char zstd_buffer[80];
594
0
#endif
595
596
0
  (void)stamp;
597
598
0
#ifdef USE_SSL
599
0
  Curl_ssl_version(ssl_buffer, sizeof(ssl_buffer));
600
0
  version_info.ssl_version = ssl_buffer;
601
0
#endif
602
603
0
#ifdef HAVE_LIBZ
604
0
  version_info.libz_version = zlibVersion();
605
  /* libz left NULL if non-existing */
606
0
#endif
607
#ifdef USE_ARES
608
  {
609
    int aresnum;
610
    version_info.ares = ares_version(&aresnum);
611
    version_info.ares_num = aresnum;
612
  }
613
#endif
614
0
#ifdef USE_LIBIDN2
615
  /* This returns a version string if we use the given version or later,
616
     otherwise it returns NULL */
617
0
  version_info.libidn = idn2_check_version(IDN2_VERSION);
618
0
#endif
619
620
#ifdef USE_SSH
621
  Curl_ssh_version(ssh_buf, sizeof(ssh_buf));
622
  version_info.libssh_version = ssh_buf;
623
#endif
624
625
0
#ifdef HAVE_BROTLI
626
0
  version_info.brotli_ver_num = BrotliDecoderVersion();
627
0
  brotli_version(brotli_buffer, sizeof(brotli_buffer));
628
0
  version_info.brotli_version = brotli_buffer;
629
0
#endif
630
631
0
#ifdef HAVE_ZSTD
632
0
  version_info.zstd_ver_num = ZSTD_versionNumber();
633
0
  zstd_version(zstd_buffer, sizeof(zstd_buffer));
634
0
  version_info.zstd_version = zstd_buffer;
635
0
#endif
636
637
0
#ifdef USE_NGHTTP2
638
0
  {
639
0
    nghttp2_info *h2 = nghttp2_version(0);
640
0
    version_info.nghttp2_ver_num = (unsigned int)h2->version_num;
641
0
    version_info.nghttp2_version = h2->version_str;
642
0
  }
643
0
#endif
644
645
#if !defined(CURL_DISABLE_HTTP) && defined(USE_HTTP3)
646
  {
647
    static char quicbuffer[80];
648
    Curl_quic_ver(quicbuffer, sizeof(quicbuffer));
649
    version_info.quic_version = quicbuffer;
650
  }
651
#endif
652
653
#ifdef USE_GSASL
654
  {
655
    version_info.gsasl_version = gsasl_check_version(NULL);
656
  }
657
#endif
658
659
  /* Get available features, build bitmask and names array. */
660
0
  n = 0;
661
0
  for(p = features_table; p->name; p++)
662
0
    if(!p->present || p->present(&version_info)) {
663
0
      features |= p->bitmask;
664
0
      feature_names[n++] = p->name;
665
0
    }
666
667
0
#ifdef DEBUGBUILD
668
0
  features |= CURL_VERSION_CURLDEBUG; /* for compatibility */
669
0
#endif
670
671
0
  feature_names[n] = NULL;  /* Terminate array. */
672
0
  version_info.features = features;
673
674
0
  return &version_info;
675
0
}