fetch: centralize logic to print remote URL
[alt-git.git] / git-curl-compat.h
blobfd96b3cdffdb6cd11b429bcada40663e80dbebc9
1 #ifndef GIT_CURL_COMPAT_H
2 #define GIT_CURL_COMPAT_H
3 #include <curl/curl.h>
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.
11 * The oldest supported version of curl is documented in the "INSTALL"
12 * document.
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/).
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.
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.
27 * Keep any symbols in date order of when their support was
28 * introduced, oldest first, in the official version of cURL library.
31 /**
32 * CURL_SOCKOPT_OK was added in 7.21.5, released in April 2011.
34 #if LIBCURL_VERSION_NUM < 0x071505
35 #define CURL_SOCKOPT_OK 0
36 #endif
38 /**
39 * CURLOPT_TCP_KEEPALIVE was added in 7.25.0, released in March 2012.
41 #if LIBCURL_VERSION_NUM >= 0x071900
42 #define GITCURL_HAVE_CURLOPT_TCP_KEEPALIVE 1
43 #endif
46 /**
47 * CURLOPT_LOGIN_OPTIONS was added in 7.34.0, released in December
48 * 2013.
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.
56 #if LIBCURL_VERSION_NUM >= 0x072200
57 #define GIT_CURL_HAVE_CURLOPT_LOGIN_OPTIONS 1
58 #endif
60 /**
61 * CURL_SSLVERSION_TLSv1_[012] was added in 7.34.0, released in
62 * December 2013.
64 #if LIBCURL_VERSION_NUM >= 0x072200
65 #define GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_0
66 #endif
68 /**
69 * CURLOPT_PINNEDPUBLICKEY was added in 7.39.0, released in November
70 * 2014. CURLE_SSL_PINNEDPUBKEYNOTMATCH was added in that same version.
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
77 /**
78 * CURL_HTTP_VERSION_2 was added in 7.43.0, released in June 2015.
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)
84 #if LIBCURL_VERSION_NUM >= 0x072b00
85 #define GIT_CURL_HAVE_CURL_HTTP_VERSION_2 1
86 #endif
88 /**
89 * CURLSSLOPT_NO_REVOKE was added in 7.44.0, released in August 2015.
91 * The CURLSSLOPT_NO_REVOKE is, has always been a macro, not an enum
92 * field (checked on curl version 7.78.0)
94 #if LIBCURL_VERSION_NUM >= 0x072c00
95 #define GIT_CURL_HAVE_CURLSSLOPT_NO_REVOKE 1
96 #endif
98 /**
99 * CURLOPT_PROXY_CAINFO was added in 7.52.0, released in August 2017.
101 #if LIBCURL_VERSION_NUM >= 0x073400
102 #define GIT_CURL_HAVE_CURLOPT_PROXY_CAINFO 1
103 #endif
106 * CURLOPT_PROXY_{KEYPASSWD,SSLCERT,SSLKEY} was added in 7.52.0,
107 * released in August 2017.
109 #if LIBCURL_VERSION_NUM >= 0x073400
110 #define GIT_CURL_HAVE_CURLOPT_PROXY_KEYPASSWD 1
111 #endif
114 * CURL_SSLVERSION_TLSv1_3 was added in 7.53.0, released in February
115 * 2017.
117 #if LIBCURL_VERSION_NUM >= 0x073400
118 #define GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_3 1
119 #endif
122 * CURLSSLSET_{NO_BACKENDS,OK,TOO_LATE,UNKNOWN_BACKEND} were added in
123 * 7.56.0, released in September 2017.
125 #if LIBCURL_VERSION_NUM >= 0x073800
126 #define GIT_CURL_HAVE_CURLSSLSET_NO_BACKENDS
127 #endif
130 * CURLOPT_PROTOCOLS_STR and CURLOPT_REDIR_PROTOCOLS_STR were added in 7.85.0,
131 * released in August 2022.
133 #if LIBCURL_VERSION_NUM >= 0x075500
134 #define GIT_CURL_HAVE_CURLOPT_PROTOCOLS_STR 1
135 #endif
137 #endif