| 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 | * Versions before curl 7.66.0 (September 2019) required manually setting the |
| 33 | * transfer-encoding for a streaming POST; after that this is handled |
| 34 | * automatically. |
| 35 | */ |
| 36 | #if LIBCURL_VERSION_NUM < 0x074200 |
| 37 | #define GIT_CURL_NEED_TRANSFER_ENCODING_HEADER |
| 38 | #endif |
| 39 | |
| 40 | /** |
| 41 | * CURLINFO_RETRY_AFTER was added in 7.66.0, released in September 2019. |
| 42 | * It allows curl to automatically parse Retry-After headers. |
| 43 | */ |
| 44 | #if LIBCURL_VERSION_NUM >= 0x074200 |
| 45 | #define GIT_CURL_HAVE_CURLINFO_RETRY_AFTER 1 |
| 46 | #endif |
| 47 | |
| 48 | /** |
| 49 | * CURLOPT_PROTOCOLS_STR and CURLOPT_REDIR_PROTOCOLS_STR were added in 7.85.0, |
| 50 | * released in August 2022. |
| 51 | */ |
| 52 | #if LIBCURL_VERSION_NUM >= 0x075500 |
| 53 | #define GIT_CURL_HAVE_CURLOPT_PROTOCOLS_STR 1 |
| 54 | #endif |
| 55 | |
| 56 | /** |
| 57 | * curl_global_trace() was added in 8.3.0, released September 2023. |
| 58 | */ |
| 59 | #if LIBCURL_VERSION_NUM >= 0x080300 |
| 60 | #define GIT_CURL_HAVE_GLOBAL_TRACE 1 |
| 61 | #endif |
| 62 | |
| 63 | /** |
| 64 | * CURLOPT_TCP_KEEPCNT was added in 8.9.0, released in July, 2024. |
| 65 | */ |
| 66 | #if LIBCURL_VERSION_NUM >= 0x080900 |
| 67 | #define GIT_CURL_HAVE_CURLOPT_TCP_KEEPCNT |
| 68 | #endif |
| 69 | |
| 70 | #endif |