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