1 #ifndef GIT_CURL_COMPAT_H
2 #define GIT_CURL_COMPAT_H
3 #include <curl/curl.h>
4 
5 /**
6  * This header centralizes the declaration of our libcurl dependencies
7  * to make it easy to discover the oldest versions we support, and to
8  * inform decisions about removing support for older libcurl in the
9  * future.
10  *
11  * The oldest supported version of curl is documented in the "INSTALL"
12  * document.
13  *
14  * The source of truth for what versions have which symbols is
15  * https://github.com/curl/curl/blob/master/docs/libcurl/symbols-in-versions;
16  * the release dates are taken from curl.git (at
17  * https://github.com/curl/curl/).
18  *
19  * For each X symbol we need from curl we define our own
20  * GIT_CURL_HAVE_X. If multiple similar symbols with the same prefix
21  * were defined in the same version we pick one and check for that name.
22  *
23  * We may also define a missing CURL_* symbol to its known value, if
24  * doing so is sufficient to add support for it to older versions that
25  * don't have it.
26  *
27  * Keep any symbols in date order of when their support was
28  * introduced, oldest first, in the official version of cURL library.
29  */
30 
31 /**
32  * CURL_SOCKOPT_OK was added in 7.21.5, released in April 2011.
33  */
34 #if LIBCURL_VERSION_NUM < 0x071505
35 #define CURL_SOCKOPT_OK 0
36 #endif
37 
38 /**
39  * CURLOPT_TCP_KEEPALIVE was added in 7.25.0, released in March 2012.
40  */
41 #if LIBCURL_VERSION_NUM >= 0x071900
42 #define GITCURL_HAVE_CURLOPT_TCP_KEEPALIVE 1
43 #endif
44 
45 
46 /**
47  * CURLOPT_LOGIN_OPTIONS was added in 7.34.0, released in December
48  * 2013.
49  *
50  * If we start requiring 7.34.0 we might also be able to remove the
51  * code conditional on USE_CURL_FOR_IMAP_SEND in imap-send.c, see
52  * 1e16b255b95 (git-imap-send: use libcurl for implementation,
53  * 2014-11-09) and the check it added for "072200" in the Makefile.
54 
55  */
56 #if LIBCURL_VERSION_NUM >= 0x072200
57 #define GIT_CURL_HAVE_CURLOPT_LOGIN_OPTIONS 1
58 #endif
59 
60 /**
61  * CURL_SSLVERSION_TLSv1_[012] was added in 7.34.0, released in
62  * December 2013.
63  */
64 #if LIBCURL_VERSION_NUM >= 0x072200
65 #define GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_0
66 #endif
67 
68 /**
69  * CURLOPT_PINNEDPUBLICKEY was added in 7.39.0, released in November
70  * 2014. CURLE_SSL_PINNEDPUBKEYNOTMATCH was added in that same version.
71  */
72 #if LIBCURL_VERSION_NUM >= 0x072c00
73 #define GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY 1
74 #define GIT_CURL_HAVE_CURLE_SSL_PINNEDPUBKEYNOTMATCH 1
75 #endif
76 
77 /**
78  * CURL_HTTP_VERSION_2 was added in 7.43.0, released in June 2015.
79  *
80  * The CURL_HTTP_VERSION_2 alias (but not CURL_HTTP_VERSION_2_0) has
81  * always been a macro, not an enum field (checked on curl version
82  * 7.78.0)
83  */
84 #if LIBCURL_VERSION_NUM >= 0x072b00
85 #define GIT_CURL_HAVE_CURL_HTTP_VERSION_2 1
86 #endif
87 
88 /**
89  * CURLSSLOPT_NO_REVOKE was added in 7.44.0, released in August 2015.
90  *
91  * The CURLSSLOPT_NO_REVOKE is, has always been a macro, not an enum
92  * field (checked on curl version 7.78.0)
93  */
94 #if LIBCURL_VERSION_NUM >= 0x072c00
95 #define GIT_CURL_HAVE_CURLSSLOPT_NO_REVOKE 1
96 #endif
97 
98 /**
99  * CURLOPT_PROXY_CAINFO was added in 7.52.0, released in August 2017.
100  */
101 #if LIBCURL_VERSION_NUM >= 0x073400
102 #define GIT_CURL_HAVE_CURLOPT_PROXY_CAINFO 1
103 #endif
104 
105 /**
106  * CURLOPT_PROXY_{KEYPASSWD,SSLCERT,SSLKEY} was added in 7.52.0,
107  * released in August 2017.
108  */
109 #if LIBCURL_VERSION_NUM >= 0x073400
110 #define GIT_CURL_HAVE_CURLOPT_PROXY_KEYPASSWD 1
111 #endif
112 
113 /**
114  * CURL_SSLVERSION_TLSv1_3 was added in 7.53.0, released in February
115  * 2017.
116  */
117 #if LIBCURL_VERSION_NUM >= 0x073400
118 #define GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_3 1
119 #endif
120 
121 /**
122  * CURLSSLSET_{NO_BACKENDS,OK,TOO_LATE,UNKNOWN_BACKEND} were added in
123  * 7.56.0, released in September 2017.
124  */
125 #if LIBCURL_VERSION_NUM >= 0x073800
126 #define GIT_CURL_HAVE_CURLSSLSET_NO_BACKENDS
127 #endif
128 
129 #endif
130