xref: /curl/docs/libcurl/curl_version_info.md (revision b042d529)
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## Debug
175
176*features* mask bit: CURL_VERSION_DEBUG
177
178libcurl was built with debug capabilities (added in 7.10.6)
179
180## ECH
181
182*features* mask bit: non-existent
183
184libcurl was built with ECH support (experimental, added in 8.8.0)
185
186## gsasl
187
188*features* mask bit: CURL_VERSION_GSASL
189
190libcurl was built with libgsasl and thus with some extra SCRAM-SHA
191authentication methods. (added in 7.76.0)
192
193## GSS-API
194
195*features* mask bit: CURL_VERSION_GSSAPI
196
197libcurl was built with support for GSS-API. This makes libcurl use provided
198functions for Kerberos and SPNEGO authentication. It also allows libcurl
199to use the current user credentials without the app having to pass them on.
200(Added in 7.38.0)
201
202## HSTS
203
204*features* mask bit: CURL_VERSION_HSTS
205
206libcurl was built with support for HSTS (HTTP Strict Transport Security)
207(Added in 7.74.0)
208
209## HTTP2
210
211*features* mask bit: CURL_VERSION_HTTP2
212
213libcurl was built with support for HTTP2.
214(Added in 7.33.0)
215
216## HTTP3
217
218*features* mask bit: CURL_VERSION_HTTP3
219
220HTTP/3 and QUIC support are built-in (Added in 7.66.0)
221
222## HTTPS-proxy
223
224*features* mask bit: CURL_VERSION_HTTPS_PROXY
225
226libcurl was built with support for HTTPS-proxy.
227(Added in 7.52.0)
228
229## IDN
230
231*features* mask bit: CURL_VERSION_IDN
232
233libcurl was built with support for IDNA, domain names with international
234letters. (Added in 7.12.0)
235
236## IPv6
237
238*features* mask bit: CURL_VERSION_IPV6
239
240supports IPv6
241
242## Kerberos
243
244*features* mask bit: CURL_VERSION_KERBEROS5
245
246supports Kerberos V5 authentication for FTP, IMAP, LDAP, POP3, SMTP and
247SOCKSv5 proxy. (Added in 7.40.0)
248
249## Largefile
250
251*features* mask bit: CURL_VERSION_LARGEFILE
252
253libcurl was built with support for large files. (Added in 7.11.1)
254
255## libz
256
257*features* mask bit: CURL_VERSION_LIBZ
258
259supports HTTP deflate using libz (Added in 7.10)
260
261## MultiSSL
262
263*features* mask bit: CURL_VERSION_MULTI_SSL
264
265libcurl was built with multiple SSL backends. For details, see
266curl_global_sslset(3).
267(Added in 7.56.0)
268
269## NTLM
270
271*features* mask bit: CURL_VERSION_NTLM
272
273supports HTTP NTLM (added in 7.10.6)
274
275## NTLM_WB
276
277*features* mask bit: CURL_VERSION_NTLM_WB
278
279libcurl was built with support for NTLM delegation to a winbind helper.
280(Added in 7.22.0) This feature was removed from curl in 8.8.0.
281
282## PSL
283
284*features* mask bit: CURL_VERSION_PSL
285
286libcurl was built with support for Mozilla's Public Suffix List. This makes
287libcurl ignore cookies with a domain that is on the list.
288(Added in 7.47.0)
289
290## SPNEGO
291
292*features* mask bit: CURL_VERSION_SPNEGO
293
294libcurl was built with support for SPNEGO authentication (Simple and Protected
295GSS-API Negotiation Mechanism, defined in RFC 2478.) (added in 7.10.8)
296
297## SSL
298
299*features* mask bit: CURL_VERSION_SSL
300
301supports SSL (HTTPS/FTPS) (Added in 7.10)
302
303## SSPI
304
305*features* mask bit: CURL_VERSION_SSPI
306
307libcurl was built with support for SSPI. This is only available on Windows and
308makes libcurl use Windows-provided functions for Kerberos, NTLM, SPNEGO and
309Digest authentication. It also allows libcurl to use the current user
310credentials without the app having to pass them on. (Added in 7.13.2)
311
312## threadsafe
313
314*features* mask bit: CURL_VERSION_THREADSAFE
315
316libcurl was built with thread-safety support (Atomic or SRWLOCK) to protect
317curl initialization. (Added in 7.84.0) See libcurl-thread(3)
318
319## TLS-SRP
320
321*features* mask bit: CURL_VERSION_TLSAUTH_SRP
322
323libcurl was built with support for TLS-SRP (in one or more of the built-in TLS
324backends). (Added in 7.21.4)
325
326## TrackMemory
327
328*features* mask bit: CURL_VERSION_CURLDEBUG
329
330libcurl was built with memory tracking debug capabilities. This is mainly of
331interest for libcurl hackers. (added in 7.19.6)
332
333## Unicode
334
335*features* mask bit: CURL_VERSION_UNICODE
336
337libcurl was built with Unicode support on Windows. This makes non-ASCII
338characters work in filenames and options passed to libcurl. (Added in 7.72.0)
339
340## UnixSockets
341
342*features* mask bit: CURL_VERSION_UNIX_SOCKETS
343
344libcurl was built with support for Unix domain sockets.
345(Added in 7.40.0)
346
347## zstd
348
349*features* mask bit: CURL_VERSION_ZSTD
350
351supports HTTP zstd content encoding using zstd library (Added in 7.72.0)
352
353## no name
354
355*features* mask bit: CURL_VERSION_CONV
356
357libcurl was built with support for character conversions, as provided by the
358CURLOPT_CONV_* callbacks. Always 0 since 7.82.0. (Added in 7.15.4,
359deprecated.)
360
361## no name
362
363*features* mask bit: CURL_VERSION_GSSNEGOTIATE
364
365supports HTTP GSS-Negotiate (added in 7.10.6, deprecated in 7.38.0)
366
367## no name
368
369*features* mask bit: CURL_VERSION_KERBEROS4
370
371supports Kerberos V4 (when using FTP). Legacy bit. Deprecated since 7.33.0.
372
373# %PROTOCOLS%
374
375# EXAMPLE
376
377~~~c
378int main(void)
379{
380  curl_version_info_data *ver = curl_version_info(CURLVERSION_NOW);
381  printf("libcurl version %u.%u.%u\n",
382         (ver->version_num >> 16) & 0xff,
383         (ver->version_num >> 8) & 0xff,
384         ver->version_num & 0xff);
385}
386~~~
387
388# %AVAILABILITY%
389
390# RETURN VALUE
391
392A pointer to a curl_version_info_data struct.
393