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