Skip to content

Commit

Permalink
Merge pull request git-for-windows#1450 from shiftkey/schannel-norevo…
Browse files Browse the repository at this point in the history
…ke-support

adding http.schannel.checkRevoke support
  • Loading branch information
dscho committed Jun 8, 2018
2 parents 67569bc + ccc5643 commit 655cf8a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Documentation/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2124,6 +2124,14 @@ http.sslBackend::
This option is ignored if cURL lacks support for choosing the SSL
backend at runtime.

http.schannel.checkRevoke::
Used to enforce or disable certificate revocation checks in cURL
when http.sslBackend is set to "schannel". Defaults to `true` if
unset. Only necessary to disable this if Git consistently errors
and the message is about checking the revocation status of a
certificate. This option is ignored if cURL lacks support for
setting the relevant SSL option at runtime.

http.pinnedpubkey::
Public key of the https service. It may either be the filename of
a PEM or DER encoded public key file or a string starting with
Expand Down
17 changes: 17 additions & 0 deletions http.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ static char *cached_accept_language;

static char *http_ssl_backend;

static int http_schannel_check_revoke = 1;

size_t fread_buffer(char *ptr, size_t eltsize, size_t nmemb, void *buffer_)
{
size_t size = eltsize * nmemb;
Expand Down Expand Up @@ -310,6 +312,11 @@ static int http_options(const char *var, const char *value, void *cb)
return 0;
}

if (!strcmp("http.schannel.checkrevoke", var)) {
http_schannel_check_revoke = git_config_bool(var, value);
return 0;
}

if (!strcmp("http.minsessions", var)) {
min_curl_sessions = git_config_int(var, value);
#ifndef USE_CURL_MULTI
Expand Down Expand Up @@ -811,6 +818,16 @@ static CURL *get_curl_handle(void)
}
#endif

if (http_ssl_backend && !strcmp("schannel", http_ssl_backend) &&
!http_schannel_check_revoke) {
#if LIBCURL_VERSION_NUM >= 0x074400
curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
#else
warning("CURLSSLOPT_NO_REVOKE not applied to curl SSL options because\n"
"your curl version is too old (>= 7.44.0)");
#endif
}

if (http_proactive_auth)
init_curl_http_auth(result);

Expand Down

0 comments on commit 655cf8a

Please sign in to comment.