Skip to content

Commit cf001bc

Browse files
committed
Merge pull request #3293 from pascalmuller/http-support-automatically-sending-client-certificate
http: Add support for enabling automatic sending of SSL client certificate
2 parents 93ed331 + b9eb6bd commit cf001bc

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

Documentation/config/http.txt

+5
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ http.schannelUseSSLCAInfo::
189189
when the `schannel` backend was configured via `http.sslBackend`,
190190
unless `http.schannelUseSSLCAInfo` overrides this behavior.
191191

192+
http.sslAutoClientCert::
193+
As of cURL v7.77.0, the Secure Channel backend won't automatically
194+
send client certificates from the Windows Certificate Store anymore.
195+
To opt in to the old behavior, http.sslAutoClientCert can be set.
196+
192197
http.pinnedpubkey::
193198
Public key of the https service. It may either be the filename of
194199
a PEM or DER encoded public key file or a string starting with

http.c

+22-4
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ static int http_schannel_check_revoke_mode =
179179
*/
180180
static int http_schannel_use_ssl_cainfo;
181181

182+
static int http_auto_client_cert;
183+
182184
size_t fread_buffer(char *ptr, size_t eltsize, size_t nmemb, void *buffer_)
183185
{
184186
size_t size = eltsize * nmemb;
@@ -357,6 +359,11 @@ static int http_options(const char *var, const char *value, void *cb)
357359
return 0;
358360
}
359361

362+
if (!strcmp("http.sslautoclientcert", var)) {
363+
http_auto_client_cert = git_config_bool(var, value);
364+
return 0;
365+
}
366+
360367
if (!strcmp("http.minsessions", var)) {
361368
min_curl_sessions = git_config_int(var, value);
362369
#ifndef USE_CURL_MULTI
@@ -920,13 +927,24 @@ static CURL *get_curl_handle(void)
920927
}
921928
#endif
922929

923-
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
924-
http_schannel_check_revoke_mode) {
930+
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend)) {
931+
long ssl_options = 0;
932+
if (http_schannel_check_revoke_mode) {
925933
#if LIBCURL_VERSION_NUM >= 0x072c00
926-
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, http_schannel_check_revoke_mode);
934+
ssl_options |= http_schannel_check_revoke_mode;
927935
#else
928-
warning(_("CURLSSLOPT_NO_REVOKE not supported with cURL < 7.44.0"));
936+
warning(_("CURLSSLOPT_NO_REVOKE not supported with cURL < 7.44.0"));
929937
#endif
938+
}
939+
940+
if (http_auto_client_cert) {
941+
#if LIBCURL_VERSION_NUM >= 0x074d00
942+
ssl_options |= CURLSSLOPT_AUTO_CLIENT_CERT;
943+
#endif
944+
}
945+
946+
if (ssl_options)
947+
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, ssl_options);
930948
}
931949

932950
if (http_proactive_auth)

0 commit comments

Comments
 (0)