@matheusbsbs / matheus-bagliano / commits / 5acb6de13d
Fork 0

[PATCH] Support for more CURL SSL settings via environment variables

Added support for additional CURL SSL settings via environment variables. Client certificate/key files can be specified as well as alternate CA information. Signed-off-by: Nick Hengeveld <nickh@reactrix.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Nick Hengeveld committed Sep 27, 2005 at 10:45 UTC 5acb6de13d7af33abcfcbdc885ec365e6a51c486
1 file changed +19
http-fetch.c
+19
@@ -36,6 +36,10 @@ static int local;
36 static int zret;
37
38 static int curl_ssl_verify;
39 +static char *ssl_cert;
40 +static char *ssl_key;
41 +static char *ssl_capath;
42 +static char *ssl_cainfo;
43
44 struct buffer
45 {
@@ -522,6 +526,21 @@ int main(int argc, char **argv)
526 curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
527 #endif
528
529 + if ((ssl_cert = getenv("GIT_SSL_CERT")) != NULL) {
530 + curl_easy_setopt(curl, CURLOPT_SSLCERT, ssl_cert);
531 + }
532 + if ((ssl_key = getenv("GIT_SSL_KEY")) != NULL) {
533 + curl_easy_setopt(curl, CURLOPT_SSLKEY, ssl_key);
534 + }
535 +#if LIBCURL_VERSION_NUM >= 0x070908
536 + if ((ssl_capath = getenv("GIT_SSL_CAPATH")) != NULL) {
537 + curl_easy_setopt(curl, CURLOPT_CAPATH, ssl_capath);
538 + }
539 +#endif
540 + if ((ssl_cainfo = getenv("GIT_SSL_CAINFO")) != NULL) {
541 + curl_easy_setopt(curl, CURLOPT_CAINFO, ssl_cainfo);
542 + }
543 +
544 alt = xmalloc(sizeof(*alt));
545 alt->base = url;
546 alt->got_indices = 0;