Coverage Report

Created: 2026-04-29 07:01

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