Skip to content

Commit 93aef7c

Browse files
shiftkeygitster
authored andcommitted
http: add support for disabling SSL revocation checks in cURL
This adds support for a new http.schannelCheckRevoke 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. Note: originally, we wanted to call the config setting `http.schannel.checkRevoke`. This, however, does not work: the `http.*` config settings can be limited to specific URLs via `http.<url>.*` (and this feature would mistake `schannel` for a URL). Helped by Agustín Martín Barbero. Signed-off-by: Brendan Forster <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 21084e8 commit 93aef7c

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Documentation/config.txt

+8
Original file line numberDiff line numberDiff line change
@@ -2241,6 +2241,14 @@ http.sslBackend::
22412241
This option is ignored if cURL lacks support for choosing the SSL
22422242
backend at runtime.
22432243

2244+
http.schannelCheckRevoke::
2245+
Used to enforce or disable certificate revocation checks in cURL
2246+
when http.sslBackend is set to "schannel". Defaults to `true` if
2247+
unset. Only necessary to disable this if Git consistently errors
2248+
and the message is about checking the revocation status of a
2249+
certificate. This option is ignored if cURL lacks support for
2250+
setting the relevant SSL option at runtime.
2251+
22442252
http.pinnedpubkey::
22452253
Public key of the https service. It may either be the filename of
22462254
a PEM or DER encoded public key file or a string starting with

http.c

+17
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ static char *cached_accept_language;
157157

158158
static char *http_ssl_backend;
159159

160+
static int http_schannel_check_revoke = 1;
161+
160162
size_t fread_buffer(char *ptr, size_t eltsize, size_t nmemb, void *buffer_)
161163
{
162164
size_t size = eltsize * nmemb;
@@ -310,6 +312,11 @@ static int http_options(const char *var, const char *value, void *cb)
310312
return 0;
311313
}
312314

315+
if (!strcmp("http.schannelcheckrevoke", var)) {
316+
http_schannel_check_revoke = git_config_bool(var, value);
317+
return 0;
318+
}
319+
313320
if (!strcmp("http.minsessions", var)) {
314321
min_curl_sessions = git_config_int(var, value);
315322
#ifndef USE_CURL_MULTI
@@ -811,6 +818,16 @@ static CURL *get_curl_handle(void)
811818
}
812819
#endif
813820

821+
if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
822+
!http_schannel_check_revoke) {
823+
#if LIBCURL_VERSION_NUM >= 0x072c00
824+
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
825+
#else
826+
warning("CURLSSLOPT_NO_REVOKE not applied to curl SSL options because\n"
827+
"your curl version is too old (< 7.44.0)");
828+
#endif
829+
}
830+
814831
if (http_proactive_auth)
815832
init_curl_http_auth(result);
816833

0 commit comments

Comments
 (0)