Skip to content

Commit e1bcb95

Browse files
committed
Merge branch 'http-ssl-backend'
This topic branch brings support for choosing cURL's SSL backend at runtime via http.sslBackend, based on patches already submitted to the cURL project and backported to cURL 7.54.1 as used in Git for Windows' SDK. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents 36ddba2 + d476f1a commit e1bcb95

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

Documentation/config.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,6 +1969,11 @@ http.sslCAPath::
19691969
with when fetching or pushing over HTTPS. Can be overridden
19701970
by the `GIT_SSL_CAPATH` environment variable.
19711971

1972+
http.sslBackend::
1973+
Name of the SSL backend to use (e.g. "openssl" or "schannel").
1974+
This option is ignored if cURL lacks support for choosing the SSL
1975+
backend at runtime.
1976+
19721977
http.pinnedpubkey::
19731978
Public key of the https service. It may either be the filename of
19741979
a PEM or DER encoded public key file or a string starting with

http.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,29 @@ static int http_options(const char *var, const char *value, void *cb)
291291
curl_ssl_try = git_config_bool(var, value);
292292
return 0;
293293
}
294+
#if LIBCURL_VERSION_NUM >= 0x073800 || \
295+
defined(CURL_WITH_EXPERIMENTAL_SSL_BACKEND_SUPPORT)
296+
if (!strcmp("http.sslbackend", var)) {
297+
const curl_ssl_backend **backends;
298+
struct strbuf buf = STRBUF_INIT;
299+
int i;
300+
301+
switch (curl_global_sslset(-1, value, &backends)) {
302+
case CURLSSLSET_UNKNOWN_BACKEND:
303+
strbuf_addf(&buf, _("Unsupported SSL backend '%s'. "
304+
"Supported SSL backends:"), value);
305+
for (i = 0; backends[i]; i++)
306+
strbuf_addf(&buf, "\n\t%s", backends[i]->name);
307+
die(buf.buf);
308+
case CURLSSLSET_TOO_LATE:
309+
die(_("Could not set SSL backend to '%s': already set"),
310+
value);
311+
case CURLSSLSET_OK:
312+
break; /* Okay! */
313+
}
314+
}
315+
#endif
316+
294317
if (!strcmp("http.minsessions", var)) {
295318
min_curl_sessions = git_config_int(var, value);
296319
#ifndef USE_CURL_MULTI

0 commit comments

Comments
 (0)