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