Skip to content

Commit 3fdedea

Browse files
committed
add support for disabling SSL revocation checks in cURL
This adds support for a new http.schannel.checkRevoke config value. This config value is only used if http.sslBackend is set to "schannel", which forces cURL to use the Windows Certificate Store when validating server certificates associated with a remote server. This config value should only be set to "false" if you are in an environment where revocation checks are blocked by the network, with no alternative options. This is only supported in cURL 7.44 or later. Signed-off-by: Brendan Forster <[email protected]>
1 parent 1a4ee4d commit 3fdedea

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

Documentation/config.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,6 +2025,14 @@ http.sslBackend::
20252025
This option is ignored if cURL lacks support for choosing the SSL
20262026
backend at runtime.
20272027

2028+
http.schannel.checkRevoke::
2029+
Used to enforce or disable certificate revocation checks in cURL
2030+
when http.sslBackend is set to "schannel". Defaults to `true` if
2031+
unset. Only necessary to disable this if Git consistently errors
2032+
and the message is about checking the revocation status of a
2033+
certificate. This option is ignored if cURL lacks support for
2034+
setting the relevant SSL option at runtime.
2035+
20282036
http.pinnedpubkey::
20292037
Public key of the https service. It may either be the filename of
20302038
a PEM or DER encoded public key file or a string starting with

http.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ static char *cached_accept_language;
148148

149149
static char *http_ssl_backend;
150150

151+
static int http_schannel_check_revoke = 1;
152+
151153
size_t fread_buffer(char *ptr, size_t eltsize, size_t nmemb, void *buffer_)
152154
{
153155
size_t size = eltsize * nmemb;
@@ -301,6 +303,11 @@ static int http_options(const char *var, const char *value, void *cb)
301303
return 0;
302304
}
303305

306+
if (!strcmp("http.schannel.checkRevoke", var)) {
307+
http_schannel_check_revoke = git_config_bool(var, value);
308+
return 0;
309+
}
310+
304311
if (!strcmp("http.minsessions", var)) {
305312
min_curl_sessions = git_config_int(var, value);
306313
#ifndef USE_CURL_MULTI
@@ -746,6 +753,15 @@ static CURL *get_curl_handle(void)
746753
}
747754
#endif
748755

756+
if (!strcmp("schannel", http_ssl_backend) && !http_schannel_check_revoke) {
757+
#if LIBCURL_VERSION_NUM >= 0x074400
758+
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
759+
#else
760+
warning("CURLSSLOPT_NO_REVOKE not applied to curl SSL options because\n"
761+
"your curl version is too old (>= 7.44.0)");
762+
#endif
763+
}
764+
749765
if (http_proactive_auth)
750766
init_curl_http_auth(result);
751767

0 commit comments

Comments
 (0)