19
19
static struct trace_key trace_curl = TRACE_KEY_INIT (CURL );
20
20
static int trace_curl_data = 1 ;
21
21
static int trace_curl_redact = 1 ;
22
- #if LIBCURL_VERSION_NUM >= 0x070a08
23
22
long int git_curl_ipresolve = CURL_IPRESOLVE_WHATEVER ;
24
- #else
25
- long int git_curl_ipresolve ;
26
- #endif
27
23
int active_requests ;
28
24
int http_is_verbose ;
29
25
ssize_t http_post_buffer = 16 * LARGE_PACKET_MAX ;
30
26
31
- #if LIBCURL_VERSION_NUM >= 0x070a06
32
- #define LIBCURL_CAN_HANDLE_AUTH_ANY
33
- #endif
34
-
35
27
static int min_curl_sessions = 1 ;
36
28
static int curl_session_count ;
37
29
#ifdef USE_CURL_MULTI
@@ -68,15 +60,9 @@ static struct {
68
60
{ "tlsv1.3" , CURL_SSLVERSION_TLSv1_3 },
69
61
#endif
70
62
};
71
- #if LIBCURL_VERSION_NUM >= 0x070903
72
63
static const char * ssl_key ;
73
- #endif
74
- #if LIBCURL_VERSION_NUM >= 0x070908
75
64
static const char * ssl_capath ;
76
- #endif
77
- #if LIBCURL_VERSION_NUM >= 0x071304
78
65
static const char * curl_no_proxy ;
79
- #endif
80
66
#if LIBCURL_VERSION_NUM >= 0x072c00
81
67
static const char * ssl_pinnedkey ;
82
68
#endif
@@ -101,9 +87,7 @@ static struct {
101
87
{ "digest" , CURLAUTH_DIGEST },
102
88
{ "negotiate" , CURLAUTH_GSSNEGOTIATE },
103
89
{ "ntlm" , CURLAUTH_NTLM },
104
- #ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
105
90
{ "anyauth" , CURLAUTH_ANY },
106
- #endif
107
91
/*
108
92
* CURLAUTH_DIGEST_IE has no corresponding command-line option in
109
93
* curl(1) and is not included in CURLAUTH_ANY, so we leave it out
@@ -143,7 +127,6 @@ enum http_follow_config http_follow_config = HTTP_FOLLOW_INITIAL;
143
127
144
128
static struct credential cert_auth = CREDENTIAL_INIT ;
145
129
static int ssl_cert_password_required ;
146
- #ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
147
130
static unsigned long http_auth_methods = CURLAUTH_ANY ;
148
131
static int http_auth_methods_restricted ;
149
132
/* Modes for which empty_auth cannot actually help us. */
@@ -153,7 +136,6 @@ static unsigned long empty_auth_useless =
153
136
| CURLAUTH_DIGEST_IE
154
137
#endif
155
138
| CURLAUTH_DIGEST ;
156
- #endif
157
139
158
140
static struct curl_slist * pragma_header ;
159
141
static struct curl_slist * no_pragma_header ;
@@ -237,12 +219,8 @@ static void finish_active_slot(struct active_request_slot *slot)
237
219
if (slot -> results != NULL ) {
238
220
slot -> results -> curl_result = slot -> curl_result ;
239
221
slot -> results -> http_code = slot -> http_code ;
240
- #if LIBCURL_VERSION_NUM >= 0x070a08
241
222
curl_easy_getinfo (slot -> curl , CURLINFO_HTTPAUTH_AVAIL ,
242
223
& slot -> results -> auth_avail );
243
- #else
244
- slot -> results -> auth_avail = 0 ;
245
- #endif
246
224
247
225
curl_easy_getinfo (slot -> curl , CURLINFO_HTTP_CONNECTCODE ,
248
226
& slot -> results -> http_connectcode );
@@ -305,14 +283,10 @@ static int http_options(const char *var, const char *value, void *cb)
305
283
return git_config_string (& ssl_version , var , value );
306
284
if (!strcmp ("http.sslcert" , var ))
307
285
return git_config_pathname (& ssl_cert , var , value );
308
- #if LIBCURL_VERSION_NUM >= 0x070903
309
286
if (!strcmp ("http.sslkey" , var ))
310
287
return git_config_pathname (& ssl_key , var , value );
311
- #endif
312
- #if LIBCURL_VERSION_NUM >= 0x070908
313
288
if (!strcmp ("http.sslcapath" , var ))
314
289
return git_config_pathname (& ssl_capath , var , value );
315
- #endif
316
290
if (!strcmp ("http.sslcainfo" , var ))
317
291
return git_config_pathname (& ssl_cainfo , var , value );
318
292
if (!strcmp ("http.sslcertpasswordprotected" , var )) {
@@ -461,12 +435,6 @@ static int curl_empty_auth_enabled(void)
461
435
if (curl_empty_auth >= 0 )
462
436
return curl_empty_auth ;
463
437
464
- #ifndef LIBCURL_CAN_HANDLE_AUTH_ANY
465
- /*
466
- * Our libcurl is too old to do AUTH_ANY in the first place;
467
- * just default to turning the feature off.
468
- */
469
- #else
470
438
/*
471
439
* In the automatic case, kick in the empty-auth
472
440
* hack as long as we would potentially try some
@@ -479,7 +447,6 @@ static int curl_empty_auth_enabled(void)
479
447
if (http_auth_methods_restricted &&
480
448
(http_auth_methods & ~empty_auth_useless ))
481
449
return 1 ;
482
- #endif
483
450
return 0 ;
484
451
}
485
452
@@ -552,7 +519,6 @@ static void init_curl_proxy_auth(CURL *result)
552
519
553
520
var_override (& http_proxy_authmethod , getenv ("GIT_HTTP_PROXY_AUTHMETHOD" ));
554
521
555
- #if LIBCURL_VERSION_NUM >= 0x070a07 /* CURLOPT_PROXYAUTH and CURLAUTH_ANY */
556
522
if (http_proxy_authmethod ) {
557
523
int i ;
558
524
for (i = 0 ; i < ARRAY_SIZE (proxy_authmethods ); i ++ ) {
@@ -570,7 +536,6 @@ static void init_curl_proxy_auth(CURL *result)
570
536
}
571
537
else
572
538
curl_easy_setopt (result , CURLOPT_PROXYAUTH , CURLAUTH_ANY );
573
- #endif
574
539
}
575
540
576
541
static int has_cert_password (void )
@@ -879,12 +844,8 @@ static CURL *get_curl_handle(void)
879
844
}
880
845
#endif
881
846
882
- #if LIBCURL_VERSION_NUM >= 0x070907
883
847
curl_easy_setopt (result , CURLOPT_NETRC , CURL_NETRC_OPTIONAL );
884
- #endif
885
- #ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
886
848
curl_easy_setopt (result , CURLOPT_HTTPAUTH , CURLAUTH_ANY );
887
- #endif
888
849
889
850
#ifdef CURLGSSAPI_DELEGATION_FLAG
890
851
if (curl_deleg ) {
@@ -940,14 +901,10 @@ static CURL *get_curl_handle(void)
940
901
curl_easy_setopt (result , CURLOPT_SSLCERT , ssl_cert );
941
902
if (has_cert_password ())
942
903
curl_easy_setopt (result , CURLOPT_KEYPASSWD , cert_auth .password );
943
- #if LIBCURL_VERSION_NUM >= 0x070903
944
904
if (ssl_key != NULL )
945
905
curl_easy_setopt (result , CURLOPT_SSLKEY , ssl_key );
946
- #endif
947
- #if LIBCURL_VERSION_NUM >= 0x070908
948
906
if (ssl_capath != NULL )
949
907
curl_easy_setopt (result , CURLOPT_CAPATH , ssl_capath );
950
- #endif
951
908
#if LIBCURL_VERSION_NUM >= 0x072c00
952
909
if (ssl_pinnedkey != NULL )
953
910
curl_easy_setopt (result , CURLOPT_PINNEDPUBLICKEY , ssl_pinnedkey );
@@ -1180,12 +1137,8 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)
1180
1137
curl_ssl_verify = 0 ;
1181
1138
1182
1139
set_from_env (& ssl_cert , "GIT_SSL_CERT" );
1183
- #if LIBCURL_VERSION_NUM >= 0x070903
1184
1140
set_from_env (& ssl_key , "GIT_SSL_KEY" );
1185
- #endif
1186
- #if LIBCURL_VERSION_NUM >= 0x070908
1187
1141
set_from_env (& ssl_capath , "GIT_SSL_CAPATH" );
1188
- #endif
1189
1142
set_from_env (& ssl_cainfo , "GIT_SSL_CAINFO" );
1190
1143
1191
1144
set_from_env (& user_agent , "GIT_HTTP_USER_AGENT" );
@@ -1367,12 +1320,8 @@ struct active_request_slot *get_active_slot(void)
1367
1320
else
1368
1321
curl_easy_setopt (slot -> curl , CURLOPT_FOLLOWLOCATION , 0 );
1369
1322
1370
- #if LIBCURL_VERSION_NUM >= 0x070a08
1371
1323
curl_easy_setopt (slot -> curl , CURLOPT_IPRESOLVE , git_curl_ipresolve );
1372
- #endif
1373
- #ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
1374
1324
curl_easy_setopt (slot -> curl , CURLOPT_HTTPAUTH , http_auth_methods );
1375
- #endif
1376
1325
if (http_auth .password || curl_empty_auth_enabled ())
1377
1326
init_curl_http_auth (slot -> curl );
1378
1327
@@ -1654,13 +1603,11 @@ static int handle_curl_result(struct slot_results *results)
1654
1603
credential_reject (& http_auth );
1655
1604
return HTTP_NOAUTH ;
1656
1605
} else {
1657
- #ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
1658
1606
http_auth_methods &= ~CURLAUTH_GSSNEGOTIATE ;
1659
1607
if (results -> auth_avail ) {
1660
1608
http_auth_methods &= results -> auth_avail ;
1661
1609
http_auth_methods_restricted = 1 ;
1662
1610
}
1663
- #endif
1664
1611
return HTTP_REAUTH ;
1665
1612
}
1666
1613
} else {
0 commit comments