Coverage Report

Created: 2026-08-14 09:29

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/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
63
{
80
63
  uint32_t brotli_version = BrotliDecoderVersion();
81
63
  unsigned int major = brotli_version >> 24;
82
63
  unsigned int minor = (brotli_version & 0x00FFFFFF) >> 12;
83
63
  unsigned int patch = brotli_version & 0x00000FFF;
84
63
  (void)curl_msnprintf(buf, bufsz, "brotli/%u.%u.%u", major, minor, patch);
85
63
}
86
#endif
87
88
#ifdef HAVE_ZSTD
89
static void zstd_version(char *buf, size_t bufsz)
90
63
{
91
63
  unsigned int version = ZSTD_versionNumber();
92
63
  unsigned int major = version / (100 * 100);
93
63
  unsigned int minor = (version - (major * 100 * 100)) / 100;
94
63
  unsigned int patch = version - (major * 100 * 100) - (minor * 100);
95
63
  (void)curl_msnprintf(buf, bufsz, "zstd/%u.%u.%u", major, minor, patch);
96
63
}
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
46
{
142
46
  static char out[300];
143
46
  char *outp;
144
46
  size_t outlen;
145
46
  const char *src[VERSION_PARTS];
146
46
#ifdef USE_SSL
147
46
  char ssl_version[200];
148
46
#endif
149
46
#ifdef HAVE_LIBZ
150
46
  char z_version[30];
151
46
#endif
152
46
#ifdef HAVE_BROTLI
153
46
  char br_version[30];
154
46
#endif
155
46
#ifdef HAVE_ZSTD
156
46
  char zstd_ver[30];
157
46
#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
#if !defined(CURL_DISABLE_HTTP) && defined(USE_NGHTTP2)
171
  char h2_version[30];
172
#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
46
  int i = 0;
186
46
  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
46
  src[i++] = LIBCURL_NAME "/" LIBCURL_VERSION;
198
46
#ifdef USE_SSL
199
46
  Curl_ssl_version(ssl_version, sizeof(ssl_version));
200
46
  src[i++] = ssl_version;
201
46
#endif
202
46
#ifdef HAVE_LIBZ
203
46
  curl_msnprintf(z_version, sizeof(z_version), "zlib/%s", zlibVersion());
204
46
  src[i++] = z_version;
205
46
#endif
206
46
#ifdef HAVE_BROTLI
207
46
  brotli_version(br_version, sizeof(br_version));
208
46
  src[i++] = br_version;
209
46
#endif
210
46
#ifdef HAVE_ZSTD
211
46
  zstd_version(zstd_ver, sizeof(zstd_ver));
212
46
  src[i++] = zstd_ver;
213
46
#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
#if !defined(CURL_DISABLE_HTTP) && defined(USE_NGHTTP2)
232
  Curl_http2_ver(h2_version, sizeof(h2_version));
233
  src[i++] = h2_version;
234
#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
#ifndef CURL_DISABLE_LDAP
257
  Curl_ldap_version(ldap_buf, sizeof(ldap_buf));
258
  src[i++] = ldap_buf;
259
#endif
260
261
46
  DEBUGASSERT(i <= VERSION_PARTS);
262
263
46
  outp = &out[0];
264
46
  outlen = sizeof(out);
265
276
  for(j = 0; j < i; j++) {
266
230
    size_t n = strlen(src[j]);
267
    /* we need room for a space, the string and the final zero */
268
230
    if(outlen <= (n + 2))
269
0
      break;
270
230
    if(j) {
271
      /* prepend a space if not the first */
272
184
      *outp++ = ' ';
273
184
      outlen--;
274
184
    }
275
230
    memcpy(outp, src[j], n);
276
230
    outp += n;
277
230
    outlen -= n;
278
230
  }
279
46
  *outp = 0;
280
281
46
  return out;
282
46
}
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
#if defined(CURL_ENABLE_SMB) && defined(USE_CURL_NTLM_CORE)
349
  "smb",
350
#  ifdef USE_SSL
351
  "smbs",
352
#  endif
353
#endif
354
#ifndef CURL_DISABLE_SMTP
355
  "smtp",
356
#endif
357
#if defined(USE_SSL) && !defined(CURL_DISABLE_SMTP)
358
  "smtps",
359
#endif
360
#ifndef CURL_DISABLE_TELNET
361
  "telnet",
362
#endif
363
#ifndef CURL_DISABLE_TFTP
364
  "tftp",
365
#endif
366
#ifndef CURL_DISABLE_HTTP
367
  /* WebSocket support relies on HTTP */
368
#ifndef CURL_DISABLE_WEBSOCKETS
369
  "ws",
370
#endif
371
#if defined(USE_SSL) && !defined(CURL_DISABLE_WEBSOCKETS)
372
  "wss",
373
#endif
374
#endif
375
376
  NULL
377
};
378
379
/*
380
 * Feature presence runtime check functions.
381
 *
382
 * Warning: the value returned by these should not change between
383
 * curl_global_init() and curl_global_cleanup() calls.
384
 */
385
386
#if defined(USE_LIBIDN2) || defined(USE_WIN32_IDN) || defined(USE_APPLE_IDN)
387
static int idn_present(curl_version_info_data *info)
388
{
389
#if defined(USE_WIN32_IDN) || defined(USE_APPLE_IDN)
390
  (void)info;
391
  return TRUE;
392
#else
393
  return !!info->libidn;
394
#endif
395
}
396
#endif
397
398
#if defined(USE_SSL) && !defined(CURL_DISABLE_PROXY) && \
399
  !defined(CURL_DISABLE_HTTP)
400
static int https_proxy_present(curl_version_info_data *info)
401
17
{
402
17
  (void)info;
403
17
  return Curl_ssl_supports(NULL, SSLSUPP_HTTPS_PROXY);
404
17
}
405
#endif
406
407
#if defined(USE_SSL) && defined(USE_ECH)
408
static int ech_present(curl_version_info_data *info)
409
{
410
  (void)info;
411
  return Curl_ssl_supports(NULL, SSLSUPP_ECH);
412
}
413
#endif
414
415
/*
416
 * Features table.
417
 *
418
 * Keep the features alphabetically sorted.
419
 * Use FEATURE() macro to define an entry: this allows documentation check.
420
 */
421
422
#define FEATURE(name, present, bitmask) { (name), (present), (bitmask) }
423
424
struct feat {
425
  const char *name;
426
  int        (*present)(curl_version_info_data *info);
427
  int        bitmask;
428
};
429
430
static const struct feat features_table[] = {
431
#ifndef CURL_DISABLE_ALTSVC
432
  FEATURE("alt-svc",     NULL,                CURL_VERSION_ALTSVC),
433
#endif
434
#if defined(USE_ARES) && defined(USE_RESOLV_THREADED) && defined(USE_HTTPSRR)
435
  FEATURE("asyn-rr",     NULL,                0),
436
#endif
437
#ifdef CURLRES_ASYNCH
438
  FEATURE("AsynchDNS",   NULL,                CURL_VERSION_ASYNCHDNS),
439
#endif
440
#ifdef HAVE_BROTLI
441
  FEATURE("brotli",      NULL,                CURL_VERSION_BROTLI),
442
#endif
443
#ifdef DEBUGBUILD
444
  FEATURE("Debug",       NULL,                CURL_VERSION_DEBUG),
445
#endif
446
#if defined(USE_SSL) && defined(USE_ECH)
447
  FEATURE("ECH",         ech_present,         0),
448
449
#ifndef USE_HTTPSRR
450
#error "ECH enabled but not HTTPSRR, must be a config error"
451
#endif
452
#endif
453
#ifdef USE_GSASL
454
  FEATURE("gsasl",       NULL,                CURL_VERSION_GSASL),
455
#endif
456
#ifdef HAVE_GSSAPI
457
  FEATURE("GSS-API",     NULL,                CURL_VERSION_GSSAPI),
458
#endif
459
#ifndef CURL_DISABLE_HSTS
460
  FEATURE("HSTS",        NULL,                CURL_VERSION_HSTS),
461
#endif
462
#if !defined(CURL_DISABLE_HTTP) && defined(USE_NGHTTP2)
463
  FEATURE("HTTP2",       NULL,                CURL_VERSION_HTTP2),
464
#endif
465
#if !defined(CURL_DISABLE_HTTP) && defined(USE_HTTP3)
466
  FEATURE("HTTP3",       NULL,                CURL_VERSION_HTTP3),
467
#endif
468
#if defined(USE_SSL) && !defined(CURL_DISABLE_PROXY) && \
469
  !defined(CURL_DISABLE_HTTP)
470
  FEATURE("HTTPS-proxy", https_proxy_present, CURL_VERSION_HTTPS_PROXY),
471
#endif
472
#ifndef CURL_DISABLE_HTTPSIG
473
  FEATURE("HTTPSIG",     NULL,                0),
474
#endif
475
#ifdef USE_HTTPSRR
476
  FEATURE("HTTPSRR",     NULL,                0),
477
#endif
478
#if defined(USE_LIBIDN2) || defined(USE_WIN32_IDN) || defined(USE_APPLE_IDN)
479
  FEATURE("IDN",         idn_present,         CURL_VERSION_IDN),
480
#endif
481
#ifdef USE_IPV6
482
  FEATURE("IPv6",        NULL,                CURL_VERSION_IPV6),
483
#endif
484
#ifdef USE_KERBEROS5
485
  FEATURE("Kerberos",    NULL,                CURL_VERSION_KERBEROS5),
486
#endif
487
#if (SIZEOF_CURL_OFF_T > 4) && ((SIZEOF_OFF_T > 4) || defined(_WIN32))
488
  FEATURE("Largefile",   NULL,                CURL_VERSION_LARGEFILE),
489
#endif
490
#ifdef HAVE_LIBZ
491
  FEATURE("libz",        NULL,                CURL_VERSION_LIBZ),
492
#endif
493
#ifdef CURL_WITH_MULTI_SSL
494
  FEATURE("MultiSSL",    NULL,                CURL_VERSION_MULTI_SSL),
495
#endif
496
#ifdef USE_NTLM
497
  FEATURE("NTLM",        NULL,                CURL_VERSION_NTLM),
498
#endif
499
#ifdef USE_PROXY_HTTP3
500
  FEATURE("proxy-HTTP3", NULL,                0),
501
#endif
502
#ifdef USE_LIBPSL
503
  FEATURE("PSL",         NULL,                CURL_VERSION_PSL),
504
#endif
505
#ifdef USE_SSL
506
#ifdef USE_APPLE_SECTRUST
507
  FEATURE("AppleSecTrust", NULL,              0),
508
#elif defined(CURL_CA_NATIVE)
509
  FEATURE("NativeCA",    NULL,              0),
510
#endif
511
#endif /* USE_SSL */
512
#ifdef USE_SPNEGO
513
  FEATURE("SPNEGO",      NULL,                CURL_VERSION_SPNEGO),
514
#endif
515
#ifdef USE_SSL
516
  FEATURE("SSL",         NULL,                CURL_VERSION_SSL),
517
#endif
518
#ifdef USE_SSLS_EXPORT
519
  FEATURE("SSLS-EXPORT", NULL,                0),
520
#endif
521
#ifdef USE_WINDOWS_SSPI
522
  FEATURE("SSPI",        NULL,                CURL_VERSION_SSPI),
523
#endif
524
#ifdef GLOBAL_INIT_IS_THREADSAFE
525
  FEATURE("threadsafe",  NULL,                CURL_VERSION_THREADSAFE),
526
#endif
527
#if defined(_WIN32) && defined(UNICODE) && defined(_UNICODE)
528
  FEATURE("Unicode",     NULL,                CURL_VERSION_UNICODE),
529
#endif
530
#ifdef USE_UNIX_SOCKETS
531
  FEATURE("UnixSockets", NULL,                CURL_VERSION_UNIX_SOCKETS),
532
#endif
533
#ifdef HAVE_ZSTD
534
  FEATURE("zstd",        NULL,                CURL_VERSION_ZSTD),
535
#endif
536
  {NULL,                 NULL,                0}
537
};
538
539
static const char *feature_names[CURL_ARRAYSIZE(features_table)] = { NULL };
540
541
static curl_version_info_data version_info = {
542
  CURLVERSION_NOW,
543
  LIBCURL_VERSION,
544
  LIBCURL_VERSION_NUM,
545
  CURL_OS, /* as found by configure or set by hand at build-time */
546
  0,    /* features bitmask is built at runtime */
547
  NULL, /* ssl_version */
548
  0,    /* ssl_version_num, this is kept at zero */
549
  NULL, /* zlib_version */
550
  supported_protocols,
551
  NULL, /* c-ares version */
552
  0,    /* c-ares version numerical */
553
  NULL, /* libidn version */
554
  0,    /* iconv version */
555
  NULL, /* ssh lib version */
556
  0,    /* brotli_ver_num */
557
  NULL, /* brotli version */
558
  0,    /* nghttp2 version number */
559
  NULL, /* nghttp2 version string */
560
  NULL, /* quic library string */
561
#ifdef CURL_CA_BUNDLE
562
  CURL_CA_BUNDLE, /* cainfo */
563
#else
564
  NULL,
565
#endif
566
#ifdef CURL_CA_PATH
567
  CURL_CA_PATH,  /* capath */
568
#else
569
  NULL,
570
#endif
571
  0,    /* zstd_ver_num */
572
  NULL, /* zstd version */
573
  NULL, /* Hyper version */
574
  NULL, /* gsasl version */
575
  feature_names,
576
  NULL  /* rtmp version */
577
};
578
579
curl_version_info_data *curl_version_info(CURLversion stamp)
580
17
{
581
17
  size_t n;
582
17
  const struct feat *p;
583
17
  int features = 0;
584
585
#ifdef USE_SSH
586
  static char ssh_buf[80];  /* 'ssh_buffer' clashes with libssh/libssh.h */
587
#endif
588
17
#ifdef USE_SSL
589
#ifdef CURL_WITH_MULTI_SSL
590
  static char ssl_buffer[200];
591
#else
592
17
  static char ssl_buffer[80];
593
17
#endif
594
17
#endif
595
17
#ifdef HAVE_BROTLI
596
17
  static char brotli_buffer[80];
597
17
#endif
598
17
#ifdef HAVE_ZSTD
599
17
  static char zstd_buffer[80];
600
17
#endif
601
602
17
  (void)stamp;
603
604
17
#ifdef USE_SSL
605
17
  Curl_ssl_version(ssl_buffer, sizeof(ssl_buffer));
606
17
  version_info.ssl_version = ssl_buffer;
607
17
#endif
608
609
17
#ifdef HAVE_LIBZ
610
17
  version_info.libz_version = zlibVersion();
611
  /* libz left NULL if non-existing */
612
17
#endif
613
#ifdef USE_ARES
614
  {
615
    int aresnum;
616
    version_info.ares = ares_version(&aresnum);
617
    version_info.ares_num = aresnum;
618
  }
619
#endif
620
#ifdef USE_LIBIDN2
621
  /* This returns a version string if we use the given version or later,
622
     otherwise it returns NULL */
623
  version_info.libidn = idn2_check_version(IDN2_VERSION);
624
#endif
625
626
#ifdef USE_SSH
627
  Curl_ssh_version(ssh_buf, sizeof(ssh_buf));
628
  version_info.libssh_version = ssh_buf;
629
#endif
630
631
17
#ifdef HAVE_BROTLI
632
17
  version_info.brotli_ver_num = BrotliDecoderVersion();
633
17
  brotli_version(brotli_buffer, sizeof(brotli_buffer));
634
17
  version_info.brotli_version = brotli_buffer;
635
17
#endif
636
637
17
#ifdef HAVE_ZSTD
638
17
  version_info.zstd_ver_num = ZSTD_versionNumber();
639
17
  zstd_version(zstd_buffer, sizeof(zstd_buffer));
640
17
  version_info.zstd_version = zstd_buffer;
641
17
#endif
642
643
#ifdef USE_NGHTTP2
644
  {
645
    nghttp2_info *h2 = nghttp2_version(0);
646
    version_info.nghttp2_ver_num = (unsigned int)h2->version_num;
647
    version_info.nghttp2_version = h2->version_str;
648
  }
649
#endif
650
651
#if !defined(CURL_DISABLE_HTTP) && defined(USE_HTTP3)
652
  {
653
    static char quicbuffer[80];
654
    Curl_quic_ver(quicbuffer, sizeof(quicbuffer));
655
    version_info.quic_version = quicbuffer;
656
  }
657
#endif
658
659
#ifdef USE_GSASL
660
  {
661
    version_info.gsasl_version = gsasl_check_version(NULL);
662
  }
663
#endif
664
665
  /* Get available features, build bitmask and names array. */
666
17
  n = 0;
667
221
  for(p = features_table; p->name; p++)
668
204
    if(!p->present || p->present(&version_info)) {
669
204
      features |= p->bitmask;
670
204
      feature_names[n++] = p->name;
671
204
    }
672
673
#ifdef DEBUGBUILD
674
  features |= CURL_VERSION_CURLDEBUG; /* for compatibility */
675
#endif
676
677
17
  feature_names[n] = NULL;  /* Terminate array. */
678
17
  version_info.features = features;
679
680
17
  return &version_info;
681
17
}