Merge branch 'bc/drop-ancient-libcurl-and-perl' into jch

Drop support for older libcURL and Perl.

* bc/drop-ancient-libcurl-and-perl:
  gitweb: make use of s///r
  Require Perl 5.26.0
  INSTALL: document requirement for libcurl 7.61.0
  git-curl-compat: remove check for curl 7.56.0
  git-curl-compat: remove check for curl 7.53.0
  git-curl-compat: remove check for curl 7.52.0
  git-curl-compat: remove check for curl 7.44.0
  git-curl-compat: remove check for curl 7.43.0
  git-curl-compat: remove check for curl 7.39.0
  git-curl-compat: remove check for curl 7.34.0
  git-curl-compat: remove check for curl 7.25.0
  git-curl-compat: remove check for curl 7.21.5
This commit is contained in:
Taylor Blau
2024-11-01 15:40:25 -04:00
21 changed files with 23 additions and 188 deletions

13
INSTALL
View File

@@ -119,7 +119,7 @@ Issues of note:
- A POSIX-compliant shell is required to run some scripts needed
for everyday use (e.g. "bisect", "request-pull").
- "Perl" version 5.8.1 or later is needed to use some of the
- "Perl" version 5.26.0 or later is needed to use some of the
features (e.g. sending patches using "git send-email",
interacting with svn repositories with "git svn"). If you can
live without these, use NO_PERL. Note that recent releases of
@@ -129,17 +129,12 @@ Issues of note:
itself, e.g. Digest::MD5, File::Spec, File::Temp, Net::Domain,
Net::SMTP, and Time::HiRes.
- git-imap-send needs the OpenSSL library to talk IMAP over SSL if
you are using libcurl older than 7.34.0. Otherwise you can use
NO_OPENSSL without losing git-imap-send.
- "libcurl" library is used for fetching and pushing
repositories over http:// or https://, as well as by
git-imap-send if the curl version is >= 7.34.0. If you do
not need that functionality, use NO_CURL to build without
it.
git-imap-send. If you do not need that functionality,
use NO_CURL to build without it.
Git requires version "7.21.3" or later of "libcurl" to build
Git requires version "7.61.0" or later of "libcurl" to build
without NO_CURL. This version requirement may be bumped in
the future.

View File

@@ -1,6 +1,6 @@
package DiffHighlight;
use 5.008001;
require v5.26;
use warnings FATAL => 'all';
use strict;

View File

@@ -1,6 +1,6 @@
package Git::Mediawiki;
use 5.008001;
require v5.26;
use strict;
use POSIX;
use Git;

View File

@@ -54,7 +54,7 @@ and can contain multiple, unrelated branches.
=cut
use 5.008001;
require v5.26;
use strict;
use warnings;
use Getopt::Std;

View File

@@ -28,104 +28,6 @@
* introduced, oldest first, in the official version of cURL library.
*/
/**
* CURL_SOCKOPT_OK was added in 7.21.5, released in April 2011.
*/
#if LIBCURL_VERSION_NUM < 0x071505
#define CURL_SOCKOPT_OK 0
#endif
/**
* CURLOPT_TCP_KEEPALIVE was added in 7.25.0, released in March 2012.
*/
#if LIBCURL_VERSION_NUM >= 0x071900
#define GITCURL_HAVE_CURLOPT_TCP_KEEPALIVE 1
#endif
/**
* CURLOPT_LOGIN_OPTIONS was added in 7.34.0, released in December
* 2013.
*
* If we start requiring 7.34.0 we might also be able to remove the
* code conditional on USE_CURL_FOR_IMAP_SEND in imap-send.c, see
* 1e16b255b95 (git-imap-send: use libcurl for implementation,
* 2014-11-09) and the check it added for "072200" in the Makefile.
*/
#if LIBCURL_VERSION_NUM >= 0x072200
#define GIT_CURL_HAVE_CURLOPT_LOGIN_OPTIONS 1
#endif
/**
* CURL_SSLVERSION_TLSv1_[012] was added in 7.34.0, released in
* December 2013.
*/
#if LIBCURL_VERSION_NUM >= 0x072200
#define GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_0
#endif
/**
* CURLOPT_PINNEDPUBLICKEY was added in 7.39.0, released in November
* 2014. CURLE_SSL_PINNEDPUBKEYNOTMATCH was added in that same version.
*/
#if LIBCURL_VERSION_NUM >= 0x072c00
#define GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY 1
#define GIT_CURL_HAVE_CURLE_SSL_PINNEDPUBKEYNOTMATCH 1
#endif
/**
* CURL_HTTP_VERSION_2 was added in 7.43.0, released in June 2015.
*
* The CURL_HTTP_VERSION_2 alias (but not CURL_HTTP_VERSION_2_0) has
* always been a macro, not an enum field (checked on curl version
* 7.78.0)
*/
#if LIBCURL_VERSION_NUM >= 0x072b00
#define GIT_CURL_HAVE_CURL_HTTP_VERSION_2 1
#endif
/**
* CURLSSLOPT_NO_REVOKE was added in 7.44.0, released in August 2015.
*
* The CURLSSLOPT_NO_REVOKE is, has always been a macro, not an enum
* field (checked on curl version 7.78.0)
*/
#if LIBCURL_VERSION_NUM >= 0x072c00
#define GIT_CURL_HAVE_CURLSSLOPT_NO_REVOKE 1
#endif
/**
* CURLOPT_PROXY_CAINFO was added in 7.52.0, released in August 2017.
*/
#if LIBCURL_VERSION_NUM >= 0x073400
#define GIT_CURL_HAVE_CURLOPT_PROXY_CAINFO 1
#endif
/**
* CURLOPT_PROXY_{KEYPASSWD,SSLCERT,SSLKEY} was added in 7.52.0,
* released in August 2017.
*/
#if LIBCURL_VERSION_NUM >= 0x073400
#define GIT_CURL_HAVE_CURLOPT_PROXY_KEYPASSWD 1
#endif
/**
* CURL_SSLVERSION_TLSv1_3 was added in 7.53.0, released in February
* 2017.
*/
#if LIBCURL_VERSION_NUM >= 0x073400
#define GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_3 1
#endif
/**
* CURLSSLSET_{NO_BACKENDS,OK,TOO_LATE,UNKNOWN_BACKEND} were added in
* 7.56.0, released in September 2017.
*/
#if LIBCURL_VERSION_NUM >= 0x073800
#define GIT_CURL_HAVE_CURLSSLSET_NO_BACKENDS
#endif
/**
* Versions before curl 7.66.0 (September 2019) required manually setting the
* transfer-encoding for a streaming POST; after that this is handled

View File

@@ -1,6 +1,6 @@
#!/usr/bin/perl
use 5.008001;
require v5.26;
use strict;
use warnings;
use Getopt::Std;

View File

@@ -13,7 +13,7 @@
# The head revision is on branch "origin" by default.
# You can change that with the '-o' option.
use 5.008001;
require v5.26;
use strict;
use warnings;
use Getopt::Long;

View File

@@ -15,7 +15,7 @@
####
####
use 5.008001;
require v5.26;
use strict;
use warnings;
use bytes;

View File

@@ -16,7 +16,7 @@
# and second line is the subject of the message.
#
use 5.008001;
require v5.26;
use strict;
use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
use Getopt::Long;

View File

@@ -1,7 +1,7 @@
#!/usr/bin/perl
# Copyright (C) 2006, Eric Wong <normalperson@yhbt.net>
# License: GPL v2 or later
use 5.008001;
require v5.26;
use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
use strict;
use vars qw/ $AUTHOR $VERSION

View File

@@ -7,7 +7,7 @@
#
# This program is licensed under the GPLv2
use 5.008001;
require v5.26;
use strict;
use warnings;
# handle ACL in file access tests
@@ -1188,7 +1188,7 @@ sub evaluate_and_validate_params {
if ($search_use_regexp) {
$search_regexp = $searchtext;
if (!eval { qr/$search_regexp/; 1; }) {
(my $error = $@) =~ s/ at \S+ line \d+.*\n?//;
my $error = $@ =~ s/ at \S+ line \d+.*\n?//r;
die_error(400, "Invalid search regexp '$search_regexp'",
esc_html($error));
}
@@ -2700,7 +2700,7 @@ sub git_cmd {
# Try to avoid using this function wherever possible.
sub quote_command {
return join(' ',
map { my $a = $_; $a =~ s/(['!])/'\\$1'/g; "'$a'" } @_ );
map { my $a = $_ =~ s/(['!])/'\\$1'/gr; "'$a'" } @_ );
}
# get HEAD ref of given project as hash

58
http.c
View File

@@ -53,22 +53,16 @@ static struct {
{ "sslv2", CURL_SSLVERSION_SSLv2 },
{ "sslv3", CURL_SSLVERSION_SSLv3 },
{ "tlsv1", CURL_SSLVERSION_TLSv1 },
#ifdef GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_0
{ "tlsv1.0", CURL_SSLVERSION_TLSv1_0 },
{ "tlsv1.1", CURL_SSLVERSION_TLSv1_1 },
{ "tlsv1.2", CURL_SSLVERSION_TLSv1_2 },
#endif
#ifdef GIT_CURL_HAVE_CURL_SSLVERSION_TLSv1_3
{ "tlsv1.3", CURL_SSLVERSION_TLSv1_3 },
#endif
};
static char *ssl_key;
static char *ssl_key_type;
static char *ssl_capath;
static char *curl_no_proxy;
#ifdef GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY
static char *ssl_pinnedkey;
#endif
static char *ssl_cainfo;
static long curl_low_speed_limit = -1;
static long curl_low_speed_time = -1;
@@ -512,12 +506,7 @@ static int http_options(const char *var, const char *value,
}
if (!strcmp("http.pinnedpubkey", var)) {
#ifdef GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY
return git_config_pathname(&ssl_pinnedkey, var, value);
#else
warning(_("Public key pinning not supported with cURL < 7.39.0"));
return 0;
#endif
}
if (!strcmp("http.extraheader", var)) {
@@ -701,7 +690,6 @@ static int has_cert_password(void)
return 1;
}
#ifdef GIT_CURL_HAVE_CURLOPT_PROXY_KEYPASSWD
static int has_proxy_cert_password(void)
{
if (http_proxy_ssl_cert == NULL || proxy_ssl_cert_password_required != 1)
@@ -715,37 +703,12 @@ static int has_proxy_cert_password(void)
}
return 1;
}
#endif
#ifdef GITCURL_HAVE_CURLOPT_TCP_KEEPALIVE
static void set_curl_keepalive(CURL *c)
{
curl_easy_setopt(c, CURLOPT_TCP_KEEPALIVE, 1);
}
#else
static int sockopt_callback(void *client, curl_socket_t fd, curlsocktype type)
{
int ka = 1;
int rc;
socklen_t len = (socklen_t)sizeof(ka);
if (type != CURLSOCKTYPE_IPCXN)
return 0;
rc = setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (void *)&ka, len);
if (rc < 0)
warning_errno("unable to set SO_KEEPALIVE on socket");
return CURL_SOCKOPT_OK;
}
static void set_curl_keepalive(CURL *c)
{
curl_easy_setopt(c, CURLOPT_SOCKOPTFUNCTION, sockopt_callback);
}
#endif
/* Return 1 if redactions have been made, 0 otherwise. */
static int redact_sensitive_header(struct strbuf *header, size_t offset)
{
@@ -1014,7 +977,6 @@ static long get_curl_allowed_protocols(int from_user, struct strbuf *list)
return bits;
}
#ifdef GIT_CURL_HAVE_CURL_HTTP_VERSION_2
static int get_curl_http_version_opt(const char *version_string, long *opt)
{
int i;
@@ -1037,8 +999,6 @@ static int get_curl_http_version_opt(const char *version_string, long *opt)
return -1; /* not found */
}
#endif
static CURL *get_curl_handle(void)
{
CURL *result = curl_easy_init();
@@ -1056,7 +1016,6 @@ static CURL *get_curl_handle(void)
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2);
}
#ifdef GIT_CURL_HAVE_CURL_HTTP_VERSION_2
if (curl_http_version) {
long opt;
if (!get_curl_http_version_opt(curl_http_version, &opt)) {
@@ -1064,7 +1023,6 @@ static CURL *get_curl_handle(void)
curl_easy_setopt(result, CURLOPT_HTTP_VERSION, opt);
}
}
#endif
curl_easy_setopt(result, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
curl_easy_setopt(result, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
@@ -1087,11 +1045,7 @@ static CURL *get_curl_handle(void)
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
!http_schannel_check_revoke) {
#ifdef GIT_CURL_HAVE_CURLSSLOPT_NO_REVOKE
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
#else
warning(_("CURLSSLOPT_NO_REVOKE not supported with cURL < 7.44.0"));
#endif
}
if (http_proactive_auth != PROACTIVE_AUTH_NONE)
@@ -1131,23 +1085,17 @@ static CURL *get_curl_handle(void)
curl_easy_setopt(result, CURLOPT_SSLKEYTYPE, ssl_key_type);
if (ssl_capath)
curl_easy_setopt(result, CURLOPT_CAPATH, ssl_capath);
#ifdef GIT_CURL_HAVE_CURLOPT_PINNEDPUBLICKEY
if (ssl_pinnedkey)
curl_easy_setopt(result, CURLOPT_PINNEDPUBLICKEY, ssl_pinnedkey);
#endif
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
!http_schannel_use_ssl_cainfo) {
curl_easy_setopt(result, CURLOPT_CAINFO, NULL);
#ifdef GIT_CURL_HAVE_CURLOPT_PROXY_CAINFO
curl_easy_setopt(result, CURLOPT_PROXY_CAINFO, NULL);
#endif
} else if (ssl_cainfo != NULL || http_proxy_ssl_ca_info != NULL) {
if (ssl_cainfo)
curl_easy_setopt(result, CURLOPT_CAINFO, ssl_cainfo);
#ifdef GIT_CURL_HAVE_CURLOPT_PROXY_CAINFO
if (http_proxy_ssl_ca_info)
curl_easy_setopt(result, CURLOPT_PROXY_CAINFO, http_proxy_ssl_ca_info);
#endif
}
if (curl_low_speed_limit > 0 && curl_low_speed_time > 0) {
@@ -1243,7 +1191,6 @@ static CURL *get_curl_handle(void)
else if (starts_with(curl_http_proxy, "socks"))
curl_easy_setopt(result,
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
#ifdef GIT_CURL_HAVE_CURLOPT_PROXY_KEYPASSWD
else if (starts_with(curl_http_proxy, "https")) {
curl_easy_setopt(result, CURLOPT_PROXYTYPE, CURLPROXY_HTTPS);
@@ -1256,7 +1203,6 @@ static CURL *get_curl_handle(void)
if (has_proxy_cert_password())
curl_easy_setopt(result, CURLOPT_PROXY_KEYPASSWD, proxy_cert_auth.password);
}
#endif
if (strstr(curl_http_proxy, "://"))
credential_from_url(&proxy_auth, curl_http_proxy);
else {
@@ -1330,7 +1276,6 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)
free(normalized_url);
string_list_clear(&config.vars, 1);
#ifdef GIT_CURL_HAVE_CURLSSLSET_NO_BACKENDS
if (http_ssl_backend) {
const curl_ssl_backend **backends;
struct strbuf buf = STRBUF_INIT;
@@ -1355,7 +1300,6 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)
break; /* Okay! */
}
}
#endif
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
die("curl_global_init failed");
@@ -1852,10 +1796,8 @@ static int handle_curl_result(struct slot_results *results)
*/
credential_reject(&cert_auth);
return HTTP_NOAUTH;
#ifdef GIT_CURL_HAVE_CURLE_SSL_PINNEDPUBKEYNOTMATCH
} else if (results->curl_result == CURLE_SSL_PINNEDPUBKEYNOTMATCH) {
return HTTP_NOMATCHPUBLICKEY;
#endif
} else if (missing_target(results))
return HTTP_MISSING_TARGET;
else if (results->http_code == 401) {

View File

@@ -1420,15 +1420,11 @@ static CURL *setup_curl(struct imap_server_conf *srvc, struct credential *cred)
curl_easy_setopt(curl, CURLOPT_PORT, srvc->port);
if (srvc->auth_method) {
#ifndef GIT_CURL_HAVE_CURLOPT_LOGIN_OPTIONS
warning("No LOGIN_OPTIONS support in this cURL version");
#else
struct strbuf auth = STRBUF_INIT;
strbuf_addstr(&auth, "AUTH=");
strbuf_addstr(&auth, srvc->auth_method);
curl_easy_setopt(curl, CURLOPT_LOGIN_OPTIONS, auth.buf);
strbuf_release(&auth);
#endif
}
if (!srvc->use_ssl)

View File

@@ -7,7 +7,7 @@ Git - Perl interface to the Git version control system
package Git;
use 5.008001;
require v5.26;
use strict;
use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();

View File

@@ -1,5 +1,5 @@
package Git::I18N;
use 5.008001;
require v5.26;
use strict;
use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
BEGIN {

View File

@@ -1,5 +1,5 @@
package Git::LoadCPAN;
use 5.008001;
require v5.26;
use strict;
use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();

View File

@@ -1,5 +1,5 @@
package Git::Packet;
use 5.008001;
require v5.26;
use strict;
use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
BEGIN {

View File

@@ -1,5 +1,5 @@
#!/usr/bin/perl
use 5.008001;
require v5.26;
use lib (split(/:/, $ENV{GITPERLLIB}));
use strict;
use warnings;

View File

@@ -1,4 +1,4 @@
use 5.008001;
require v5.26;
use strict;
use warnings;

View File

@@ -1,7 +1,7 @@
#!/usr/bin/perl
use lib (split(/:/, $ENV{GITPERLLIB}));
use 5.008001;
require v5.26;
use warnings;
use strict;

View File

@@ -1,5 +1,5 @@
#!/usr/bin/perl
use 5.008001;
require v5.26;
use strict;
use warnings;
use IO::Pty;