1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: curl_version_info 5Section: 3 6Source: libcurl 7See-also: 8 - curl_version (3) 9Protocol: 10 - All 11Added-in: 7.10.0 12--- 13 14# NAME 15 16curl_version_info - returns runtime libcurl version info 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23curl_version_info_data *curl_version_info(CURLversion age); 24~~~ 25 26# DESCRIPTION 27 28Returns a pointer to a filled in static struct with information about various 29features in the running version of libcurl. *age* should be set to the 30version of this functionality by the time you write your program. This way, 31libcurl always returns a proper struct that your program understands, while 32programs in the future might get a different struct. **CURLVERSION_NOW** is 33the most recent one for the library you have installed: 34~~~c 35 data = curl_version_info(CURLVERSION_NOW); 36~~~ 37Applications should use this information to judge if things are possible to do 38or not, instead of using compile-time checks, as dynamic/DLL libraries can be 39changed independent of applications. 40 41This function can alter the returned static data as long as 42curl_global_init(3) has not been called. It is therefore not thread-safe 43before libcurl initialization occurs. 44 45The curl_version_info_data struct looks like this 46 47~~~c 48typedef struct { 49 CURLversion age; /* see description below */ 50 51 const char *version; /* human readable string */ 52 unsigned int version_num; /* numeric representation */ 53 const char *host; /* human readable string */ 54 int features; /* bitmask, see below */ 55 char *ssl_version; /* human readable string */ 56 long ssl_version_num; /* not used, always zero */ 57 const char *libz_version; /* human readable string */ 58 const char *const *protocols; /* protocols */ 59 60 /* when 'age' is CURLVERSION_SECOND or higher, the members below exist */ 61 const char *ares; /* human readable string */ 62 int ares_num; /* number */ 63 64 /* when 'age' is CURLVERSION_THIRD or higher, the members below exist */ 65 const char *libidn; /* human readable string */ 66 67 /* when 'age' is CURLVERSION_FOURTH or higher (>= 7.16.1), the members 68 below exist */ 69 int iconv_ver_num; /* '_libiconv_version' if iconv support enabled */ 70 71 const char *libssh_version; /* human readable string */ 72 73 /* when 'age' is CURLVERSION_FIFTH or higher (>= 7.57.0), the members 74 below exist */ 75 unsigned int brotli_ver_num; /* Numeric Brotli version 76 (MAJOR << 24) | (MINOR << 12) | PATCH */ 77 const char *brotli_version; /* human readable string. */ 78 79 /* when 'age' is CURLVERSION_SIXTH or higher (>= 7.66.0), the members 80 below exist */ 81 unsigned int nghttp2_ver_num; /* Numeric nghttp2 version 82 (MAJOR << 16) | (MINOR << 8) | PATCH */ 83 const char *nghttp2_version; /* human readable string. */ 84 85 const char *quic_version; /* human readable quic (+ HTTP/3) library + 86 version or NULL */ 87 88 /* when 'age' is CURLVERSION_SEVENTH or higher (>= 7.70.0), the members 89 below exist */ 90 const char *cainfo; /* the built-in default CURLOPT_CAINFO, might 91 be NULL */ 92 const char *capath; /* the built-in default CURLOPT_CAPATH, might 93 be NULL */ 94 /* when 'age' is CURLVERSION_EIGHTH or higher (>= 7.71.0), the members 95 below exist */ 96 unsigned int zstd_ver_num; /* Numeric Zstd version 97 (MAJOR << 24) | (MINOR << 12) | PATCH */ 98 const char *zstd_version; /* human readable string. */ 99 /* when 'age' is CURLVERSION_NINTH or higher (>= 7.75.0), the members 100 below exist */ 101 const char *hyper_version; /* human readable string. */ 102 /* when 'age' is CURLVERSION_TENTH or higher (>= 7.77.0), the members 103 below exist */ 104 const char *gsasl_version; /* human readable string. */ 105 /* when 'age' is CURLVERSION_ELEVENTH or higher (>= 7.87.0), the members 106 below exist */ 107 const char *const *feature_names; /* Feature names. */ 108 /* when 'age' is CURLVERSION_TWELFTH or higher (>= 8.8.0), the members 109 below exist */ 110 const char *const *rtmp_version; /* human readable string */ 111} curl_version_info_data; 112~~~ 113 114*age* describes what the age of this struct is. The number depends on how 115new the libcurl you are using is. You are however guaranteed to get a struct 116that you have a matching struct for in the header, as you tell libcurl your 117"age" with the input argument. 118 119*version* is just an ASCII string for the libcurl version. 120 121*version_num* is a 24 bit number created like this: \<8 bits major number\> | 122\<8 bits minor number\> | \<8 bits patch number\>. Version 7.9.8 is therefore 123returned as 0x070908. 124 125*host* is an ASCII string showing what host information that this libcurl 126was built for. As discovered by a configure script or set by the build 127environment. 128 129*features* is a bit mask representing available features. It can have none, 130one or more bits set. The use of this field is deprecated: use 131*feature_names* instead. The feature names description below lists the 132associated bits. 133 134*feature_names* is a pointer to an array of string pointers, containing the 135names of the features that libcurl supports. The array is terminated by a NULL 136entry. See the list of features names below. 137 138*ssl_version* is an ASCII string for the TLS library name + version used. If 139libcurl has no SSL support, this is NULL. For example "Schannel", "Secure 140Transport" or "OpenSSL/1.1.0g". 141 142*ssl_version_num* is always 0. 143 144*libz_version* is an ASCII string (there is no numerical version). If 145libcurl has no libz support, this is NULL. 146 147*protocols* is a pointer to an array of char * pointers, containing the 148names protocols that libcurl supports (using lowercase letters). The protocol 149names are the same as would be used in URLs. The array is terminated by a NULL 150entry. 151 152# FEATURES 153 154## `alt-svc` 155 156*features* mask bit: CURL_VERSION_ALTSVC 157 158HTTP Alt-Svc parsing and the associated options (Added in 7.64.1) 159 160## `AsynchDNS` 161 162*features* mask bit: CURL_VERSION_ASYNCHDNS 163 164libcurl was built with support for asynchronous name lookups, which allows 165more exact timeouts (even on Windows) and less blocking when using the multi 166interface. (added in 7.10.7) 167 168## `brotli` 169 170*features* mask bit: CURL_VERSION_BROTLI 171 172supports HTTP Brotli content encoding using libbrotlidec (Added in 7.57.0) 173 174## `asyn-rr` 175 176*features* mask bit: non-existent 177 178libcurl was built to use c-ares for EXPERIMENTAL HTTPS resource record 179resolves, but uses the threaded resolver for "normal" resolves (Added in 1808.12.0) 181 182## `Debug` 183 184*features* mask bit: CURL_VERSION_DEBUG 185 186libcurl was built with debug capabilities (added in 7.10.6) 187 188## `ECH` 189 190*features* mask bit: non-existent 191 192libcurl was built with ECH support (experimental, added in 8.8.0) 193 194## `gsasl` 195 196*features* mask bit: CURL_VERSION_GSASL 197 198libcurl was built with libgsasl and thus with some extra SCRAM-SHA 199authentication methods. (added in 7.76.0) 200 201## `GSS-API` 202 203*features* mask bit: CURL_VERSION_GSSAPI 204 205libcurl was built with support for GSS-API. This makes libcurl use provided 206functions for Kerberos and SPNEGO authentication. It also allows libcurl 207to use the current user credentials without the app having to pass them on. 208(Added in 7.38.0) 209 210## `HSTS` 211 212*features* mask bit: CURL_VERSION_HSTS 213 214libcurl was built with support for HSTS (HTTP Strict Transport Security) 215(Added in 7.74.0) 216 217## `HTTP2` 218 219*features* mask bit: CURL_VERSION_HTTP2 220 221libcurl was built with support for HTTP2. 222(Added in 7.33.0) 223 224## `HTTP3` 225 226*features* mask bit: CURL_VERSION_HTTP3 227 228HTTP/3 and QUIC support are built-in (Added in 7.66.0) 229 230## `HTTPS-proxy` 231 232*features* mask bit: CURL_VERSION_HTTPS_PROXY 233 234libcurl was built with support for HTTPS-proxy. 235(Added in 7.52.0) 236 237## `HTTPSRR` 238 239*features* mask bit: non-existent 240 241libcurl was built with EXPERIMENTAL support for HTTPS resource records (Added 242in 8.12.0) 243 244## `IDN` 245 246*features* mask bit: CURL_VERSION_IDN 247 248libcurl was built with support for IDNA, domain names with international 249letters. (Added in 7.12.0) 250 251## `IPv6` 252 253*features* mask bit: CURL_VERSION_IPV6 254 255supports IPv6 256 257## `Kerberos` 258 259*features* mask bit: CURL_VERSION_KERBEROS5 260 261supports Kerberos V5 authentication for FTP, IMAP, LDAP, POP3, SMTP and 262SOCKSv5 proxy. (Added in 7.40.0) 263 264## `Largefile` 265 266*features* mask bit: CURL_VERSION_LARGEFILE 267 268libcurl was built with support for large files. (Added in 7.11.1) 269 270## `libz` 271 272*features* mask bit: CURL_VERSION_LIBZ 273 274supports HTTP deflate using libz (Added in 7.10) 275 276## `MultiSSL` 277 278*features* mask bit: CURL_VERSION_MULTI_SSL 279 280libcurl was built with multiple SSL backends. For details, see 281curl_global_sslset(3). 282(Added in 7.56.0) 283 284## `NTLM` 285 286*features* mask bit: CURL_VERSION_NTLM 287 288supports HTTP NTLM (added in 7.10.6) 289 290## `NTLM_WB` 291 292*features* mask bit: CURL_VERSION_NTLM_WB 293 294libcurl was built with support for NTLM delegation to a winbind helper. 295(Added in 7.22.0) This feature was removed from curl in 8.8.0. 296 297## `PSL` 298 299*features* mask bit: CURL_VERSION_PSL 300 301libcurl was built with support for Mozilla's Public Suffix List. This makes 302libcurl ignore cookies with a domain that is on the list. 303(Added in 7.47.0) 304 305## `SPNEGO` 306 307*features* mask bit: CURL_VERSION_SPNEGO 308 309libcurl was built with support for SPNEGO authentication (Simple and Protected 310GSS-API Negotiation Mechanism, defined in RFC 2478.) (added in 7.10.8) 311 312## `SSL` 313 314*features* mask bit: CURL_VERSION_SSL 315 316supports SSL (HTTPS/FTPS) (Added in 7.10) 317 318## `SSLS-EXPORT` 319 320*features* mask bit: non-existent 321 322libcurl was built with SSL session import/export support 323(experimental, added in 8.12.0) 324 325## `SSPI` 326 327*features* mask bit: CURL_VERSION_SSPI 328 329libcurl was built with support for SSPI. This is only available on Windows and 330makes libcurl use Windows-provided functions for Kerberos, NTLM, SPNEGO and 331Digest authentication. It also allows libcurl to use the current user 332credentials without the app having to pass them on. (Added in 7.13.2) 333 334## `threadsafe` 335 336*features* mask bit: CURL_VERSION_THREADSAFE 337 338libcurl was built with thread-safety support (Atomic or SRWLOCK) to protect 339curl initialization. (Added in 7.84.0) See libcurl-thread(3) 340 341## `TLS-SRP` 342 343*features* mask bit: CURL_VERSION_TLSAUTH_SRP 344 345libcurl was built with support for TLS-SRP (in one or more of the built-in TLS 346backends). (Added in 7.21.4) 347 348## `TrackMemory` 349 350*features* mask bit: CURL_VERSION_CURLDEBUG 351 352libcurl was built with memory tracking debug capabilities. This is mainly of 353interest for libcurl hackers. (added in 7.19.6) 354 355## `Unicode` 356 357*features* mask bit: CURL_VERSION_UNICODE 358 359libcurl was built with Unicode support on Windows. This makes non-ASCII 360characters work in filenames and options passed to libcurl. (Added in 7.72.0) 361 362## `UnixSockets` 363 364*features* mask bit: CURL_VERSION_UNIX_SOCKETS 365 366libcurl was built with support for Unix domain sockets. 367(Added in 7.40.0) 368 369## `zstd` 370 371*features* mask bit: CURL_VERSION_ZSTD 372 373supports HTTP zstd content encoding using zstd library (Added in 7.72.0) 374 375## no name 376 377*features* mask bit: CURL_VERSION_CONV 378 379libcurl was built with support for character conversions, as provided by the 380CURLOPT_CONV_* callbacks. Always 0 since 7.82.0. (Added in 7.15.4, 381deprecated.) 382 383## no name 384 385*features* mask bit: CURL_VERSION_GSSNEGOTIATE 386 387supports HTTP GSS-Negotiate (added in 7.10.6, deprecated in 7.38.0) 388 389## no name 390 391*features* mask bit: CURL_VERSION_KERBEROS4 392 393supports Kerberos V4 (when using FTP). Legacy bit. Deprecated since 7.33.0. 394 395# %PROTOCOLS% 396 397# EXAMPLE 398 399~~~c 400int main(void) 401{ 402 curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW); 403 printf("libcurl version %u.%u.%u\n", 404 (ver->version_num >> 16) & 0xff, 405 (ver->version_num >> 8) & 0xff, 406 ver->version_num & 0xff); 407} 408~~~ 409 410# %AVAILABILITY% 411 412# RETURN VALUE 413 414A pointer to a curl_version_info_data struct. 415