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