From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Cc: Jonathan Nieder <jrnieder@gmail.com>
Subject: [RFC] dropping support for ancient versions of curl
Date: Mon, 3 Apr 2017 22:54:38 -0400 [thread overview]
Message-ID: <20170404025438.bgxz5sfmrawqswcj@sigill.intra.peff.net> (raw)
A nearby thread raised the question of whether we can rely on a version
of libcurl that contains a particular feature. The version in question
is curl 7.11.1, which came out in March 2004.
My feeling is that this is old enough to stop caring about. Which means
we can drop some of the #ifdefs that clutter the HTTP code (and there's
a patch at the end of this mail dropping support for everything older
than 7.11.1). But that made wonder: how old is too old? I think it's
nice that we don't force people to upgrade to the latest version of
curl. But at some point, if you are running a 13-year-old version of
libcurl, how likely are you to run a brand new version of Git? :)
If we declared 7.16.0 as a cutoff, we could unconditionally define
USE_CURL_MULTI, which gets rid of quite a few messy ifdefs.
-Peff
---
http.c | 51 -----------------------------------
http.h | 11 --------
remote-curl.c | 3 ---
3 files changed, 65 deletions(-)
diff --git a/http.c b/http.c
index 8d94e2c63..7a81f0b68 100644
--- a/http.c
+++ b/http.c
@@ -12,19 +12,11 @@
#include "transport.h"
static struct trace_key trace_curl = TRACE_KEY_INIT(CURL);
-#if LIBCURL_VERSION_NUM >= 0x070a08
long int git_curl_ipresolve = CURL_IPRESOLVE_WHATEVER;
-#else
-long int git_curl_ipresolve;
-#endif
int active_requests;
int http_is_verbose;
size_t http_post_buffer = 16 * LARGE_PACKET_MAX;
-#if LIBCURL_VERSION_NUM >= 0x070a06
-#define LIBCURL_CAN_HANDLE_AUTH_ANY
-#endif
-
static int min_curl_sessions = 1;
static int curl_session_count;
#ifdef USE_CURL_MULTI
@@ -57,12 +49,8 @@ static struct {
{ "tlsv1.2", CURL_SSLVERSION_TLSv1_2 },
#endif
};
-#if LIBCURL_VERSION_NUM >= 0x070903
static const char *ssl_key;
-#endif
-#if LIBCURL_VERSION_NUM >= 0x070908
static const char *ssl_capath;
-#endif
#if LIBCURL_VERSION_NUM >= 0x072c00
static const char *ssl_pinnedkey;
#endif
@@ -81,9 +69,7 @@ static struct {
{ "digest", CURLAUTH_DIGEST },
{ "negotiate", CURLAUTH_GSSNEGOTIATE },
{ "ntlm", CURLAUTH_NTLM },
-#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
{ "anyauth", CURLAUTH_ANY },
-#endif
/*
* CURLAUTH_DIGEST_IE has no corresponding command-line option in
* curl(1) and is not included in CURLAUTH_ANY, so we leave it out
@@ -123,7 +109,6 @@ enum http_follow_config http_follow_config = HTTP_FOLLOW_INITIAL;
static struct credential cert_auth = CREDENTIAL_INIT;
static int ssl_cert_password_required;
-#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
static unsigned long http_auth_methods = CURLAUTH_ANY;
static int http_auth_methods_restricted;
/* Modes for which empty_auth cannot actually help us. */
@@ -133,7 +118,6 @@ static unsigned long empty_auth_useless =
| CURLAUTH_DIGEST_IE
#endif
| CURLAUTH_DIGEST;
-#endif
static struct curl_slist *pragma_header;
static struct curl_slist *no_pragma_header;
@@ -207,12 +191,8 @@ static void finish_active_slot(struct active_request_slot *slot)
if (slot->results != NULL) {
slot->results->curl_result = slot->curl_result;
slot->results->http_code = slot->http_code;
-#if LIBCURL_VERSION_NUM >= 0x070a08
curl_easy_getinfo(slot->curl, CURLINFO_HTTPAUTH_AVAIL,
&slot->results->auth_avail);
-#else
- slot->results->auth_avail = 0;
-#endif
curl_easy_getinfo(slot->curl, CURLINFO_HTTP_CONNECTCODE,
&slot->results->http_connectcode);
@@ -272,14 +252,10 @@ static int http_options(const char *var, const char *value, void *cb)
return git_config_string(&ssl_version, var, value);
if (!strcmp("http.sslcert", var))
return git_config_string(&ssl_cert, var, value);
-#if LIBCURL_VERSION_NUM >= 0x070903
if (!strcmp("http.sslkey", var))
return git_config_string(&ssl_key, var, value);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x070908
if (!strcmp("http.sslcapath", var))
return git_config_pathname(&ssl_capath, var, value);
-#endif
if (!strcmp("http.sslcainfo", var))
return git_config_pathname(&ssl_cainfo, var, value);
if (!strcmp("http.sslcertpasswordprotected", var)) {
@@ -398,12 +374,6 @@ static int curl_empty_auth_enabled(void)
if (curl_empty_auth >= 0)
return curl_empty_auth;
-#ifndef LIBCURL_CAN_HANDLE_AUTH_ANY
- /*
- * Our libcurl is too old to do AUTH_ANY in the first place;
- * just default to turning the feature off.
- */
-#else
/*
* In the automatic case, kick in the empty-auth
* hack as long as we would potentially try some
@@ -416,7 +386,6 @@ static int curl_empty_auth_enabled(void)
if (http_auth_methods_restricted &&
(http_auth_methods & ~empty_auth_useless))
return 1;
-#endif
return 0;
}
@@ -487,7 +456,6 @@ static void init_curl_proxy_auth(CURL *result)
var_override(&http_proxy_authmethod, getenv("GIT_HTTP_PROXY_AUTHMETHOD"));
-#if LIBCURL_VERSION_NUM >= 0x070a07 /* CURLOPT_PROXYAUTH and CURLAUTH_ANY */
if (http_proxy_authmethod) {
int i;
for (i = 0; i < ARRAY_SIZE(proxy_authmethods); i++) {
@@ -505,7 +473,6 @@ static void init_curl_proxy_auth(CURL *result)
}
else
curl_easy_setopt(result, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
-#endif
}
static int has_cert_password(void)
@@ -707,12 +674,8 @@ static CURL *get_curl_handle(void)
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2);
}
-#if LIBCURL_VERSION_NUM >= 0x070907
curl_easy_setopt(result, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
-#endif
-#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
curl_easy_setopt(result, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
-#endif
#if LIBCURL_VERSION_NUM >= 0x071600
if (curl_deleg) {
@@ -759,14 +722,10 @@ static CURL *get_curl_handle(void)
curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert);
if (has_cert_password())
curl_easy_setopt(result, CURLOPT_KEYPASSWD, cert_auth.password);
-#if LIBCURL_VERSION_NUM >= 0x070903
if (ssl_key != NULL)
curl_easy_setopt(result, CURLOPT_SSLKEY, ssl_key);
-#endif
-#if LIBCURL_VERSION_NUM >= 0x070908
if (ssl_capath != NULL)
curl_easy_setopt(result, CURLOPT_CAPATH, ssl_capath);
-#endif
#if LIBCURL_VERSION_NUM >= 0x072c00
if (ssl_pinnedkey != NULL)
curl_easy_setopt(result, CURLOPT_PINNEDPUBLICKEY, ssl_pinnedkey);
@@ -933,12 +892,8 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)
curl_ssl_verify = 0;
set_from_env(&ssl_cert, "GIT_SSL_CERT");
-#if LIBCURL_VERSION_NUM >= 0x070903
set_from_env(&ssl_key, "GIT_SSL_KEY");
-#endif
-#if LIBCURL_VERSION_NUM >= 0x070908
set_from_env(&ssl_capath, "GIT_SSL_CAPATH");
-#endif
set_from_env(&ssl_cainfo, "GIT_SSL_CAINFO");
set_from_env(&user_agent, "GIT_HTTP_USER_AGENT");
@@ -1111,12 +1066,8 @@ struct active_request_slot *get_active_slot(void)
else
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 0);
-#if LIBCURL_VERSION_NUM >= 0x070a08
curl_easy_setopt(slot->curl, CURLOPT_IPRESOLVE, git_curl_ipresolve);
-#endif
-#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
curl_easy_setopt(slot->curl, CURLOPT_HTTPAUTH, http_auth_methods);
-#endif
if (http_auth.password || curl_empty_auth_enabled())
init_curl_http_auth(slot->curl);
@@ -1383,13 +1334,11 @@ static int handle_curl_result(struct slot_results *results)
credential_reject(&http_auth);
return HTTP_NOAUTH;
} else {
-#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
http_auth_methods &= ~CURLAUTH_GSSNEGOTIATE;
if (results->auth_avail) {
http_auth_methods &= results->auth_avail;
http_auth_methods_restricted = 1;
}
-#endif
return HTTP_REAUTH;
}
} else {
diff --git a/http.h b/http.h
index 02bccb7b0..d1de11a3d 100644
--- a/http.h
+++ b/http.h
@@ -22,21 +22,10 @@
#define DEFAULT_MAX_REQUESTS 5
#endif
-#if LIBCURL_VERSION_NUM < 0x070704
-#define curl_global_cleanup() do { /* nothing */ } while (0)
-#endif
-#if LIBCURL_VERSION_NUM < 0x070800
-#define curl_global_init(a) do { /* nothing */ } while (0)
-#endif
-
#if (LIBCURL_VERSION_NUM < 0x070c04) || (LIBCURL_VERSION_NUM == 0x071000)
#define NO_CURL_EASY_DUPHANDLE
#endif
-#if LIBCURL_VERSION_NUM < 0x070a03
-#define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND
-#endif
-
#if LIBCURL_VERSION_NUM < 0x070c03
#define NO_CURL_IOCTL
#endif
diff --git a/remote-curl.c b/remote-curl.c
index e953d06f6..c792942f0 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -143,8 +143,6 @@ static int set_option(const char *name, const char *value)
} else if (!strcmp(name, "push-option")) {
string_list_append(&options.push_options, value);
return 0;
-
-#if LIBCURL_VERSION_NUM >= 0x070a08
} else if (!strcmp(name, "family")) {
if (!strcmp(value, "ipv4"))
git_curl_ipresolve = CURL_IPRESOLVE_V4;
@@ -155,7 +153,6 @@ static int set_option(const char *name, const char *value)
else
return -1;
return 0;
-#endif /* LIBCURL_VERSION_NUM >= 0x070a08 */
} else {
return 1 /* unsupported */;
}
next reply other threads:[~2017-04-04 2:54 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-04 2:54 Jeff King [this message]
2017-04-04 3:08 ` [RFC] dropping support for ancient versions of curl Jeff King
2017-04-04 5:44 ` Jessie Hernandez
2017-04-04 8:17 ` Ævar Arnfjörð Bjarmason
2017-04-04 8:33 ` Jeff King
2017-04-04 10:44 ` Ævar Arnfjörð Bjarmason
2017-04-04 11:54 ` Johannes Schindelin
2017-04-04 14:06 ` Ævar Arnfjörð Bjarmason
2017-04-04 16:53 ` Brandon Williams
2017-04-04 22:46 ` Johannes Schindelin
2017-04-04 23:03 ` Brandon Williams
2017-04-04 23:03 ` Stefan Beller
2017-04-05 8:49 ` Johannes Schindelin
2017-04-05 9:29 ` Jeff King
2017-04-04 20:16 ` Jeff King
2017-04-04 13:32 ` Frank Gevaerts
2017-04-05 9:33 ` Tom G. Christensen
2017-04-05 10:51 ` Ævar Arnfjörð Bjarmason
2017-04-05 13:04 ` [PATCH 0/7] Patches to support older RHEL releases Tom G. Christensen
2017-04-05 13:04 ` [PATCH 1/7] Make NO_PERL_MAKEMAKER behave more like ExtUtils::MakeMaker Tom G. Christensen
2017-04-05 13:04 ` [PATCH 2/7] Install man pages when NO_PERL_MAKEMAKER is used Tom G. Christensen
2017-04-05 13:04 ` [PATCH 3/7] Allow svnrdump_sim.py to be used with Python 2.2 Tom G. Christensen
2017-04-05 13:40 ` Ævar Arnfjörð Bjarmason
2017-04-05 14:36 ` Tom G. Christensen
2017-04-05 13:04 ` [PATCH 4/7] Handle missing HTTP_CONNECTCODE in curl < 7.10.7 Tom G. Christensen
2017-04-05 13:50 ` Ævar Arnfjörð Bjarmason
2017-04-05 15:58 ` Franke, Knut
2017-04-05 13:04 ` [PATCH 5/7] Add support for gnupg < 1.4 Tom G. Christensen
2017-04-05 13:45 ` Ævar Arnfjörð Bjarmason
2017-04-13 6:31 ` Junio C Hamano
2017-04-13 15:17 ` Ævar Arnfjörð Bjarmason
2017-04-05 13:04 ` [PATCH 6/7] Handle missing CURLINFO_SSL_DATA_{IN,OUT} Tom G. Christensen
2017-04-05 13:52 ` Ævar Arnfjörð Bjarmason
2017-04-05 13:04 ` [PATCH 7/7] Do not use curl_easy_strerror with curl < 7.12.0 Tom G. Christensen
2017-04-05 13:53 ` Ævar Arnfjörð Bjarmason
2017-04-06 9:18 ` Jeff King
2017-04-13 6:28 ` Junio C Hamano
2017-04-13 10:52 ` Jacob Keller
2017-04-05 13:04 ` [RFC] dropping support for ancient versions of curl Tom G. Christensen
2017-04-06 0:53 ` brian m. carlson
2017-04-06 1:16 ` Todd Zullinger
2017-04-06 9:29 ` Jeff King
2017-04-07 11:18 ` Johannes Schindelin
2017-04-10 18:22 ` Jeff King
2017-04-06 9:21 ` Jeff King
2017-04-06 16:43 ` Tom G. Christensen
2017-04-07 4:54 ` Jeff King
2017-04-14 11:12 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170404025438.bgxz5sfmrawqswcj@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).