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