86
static int curl_ftp_no_epsv;
87
static const char *curl_http_proxy;
88
static const char *http_proxy_authmethod;
89
+
90
+static const char *http_proxy_ssl_cert;
91
+static const char *http_proxy_ssl_key;
92
+static const char *http_proxy_ssl_ca_info;
93
+static struct credential proxy_cert_auth = CREDENTIAL_INIT;
94
+static int proxy_ssl_cert_password_required;
95
+
96
static struct {
97
const char *name;
98
long curlauth_param;
372
if (!strcmp("http.proxyauthmethod", var))
373
return git_config_string(&http_proxy_authmethod, var, value);
374
375
+ if (!strcmp("http.proxysslcert", var))
376
+ return git_config_string(&http_proxy_ssl_cert, var, value);
377
+
378
+ if (!strcmp("http.proxysslkey", var))
379
+ return git_config_string(&http_proxy_ssl_key, var, value);
380
+
381
+ if (!strcmp("http.proxysslcainfo", var))
382
+ return git_config_string(&http_proxy_ssl_ca_info, var, value);
383
+
384
+ if (!strcmp("http.proxysslcertpasswordprotected", var)) {
385
+ proxy_ssl_cert_password_required = git_config_bool(var, value);
386
+ return 0;
387
+ }
388
+
389
if (!strcmp("http.cookiefile", var))
390
return git_config_pathname(&curl_cookie_file, var, value);
391
if (!strcmp("http.savecookies", var)) {
586
return 1;
587
}
588
589
+#if LIBCURL_VERSION_NUM >= 0x073400
590
+static int has_proxy_cert_password(void)
591
+{
592
+ if (http_proxy_ssl_cert == NULL || proxy_ssl_cert_password_required != 1)
593
+ return 0;
594
+ if (!proxy_cert_auth.password) {
595
+ proxy_cert_auth.protocol = xstrdup("cert");
596
+ proxy_cert_auth.username = xstrdup("");
597
+ proxy_cert_auth.path = xstrdup(http_proxy_ssl_cert);
598
+ credential_fill(&proxy_cert_auth);
599
+ }
600
+ return 1;
601
+}
602
+#endif
603
+
604
#if LIBCURL_VERSION_NUM >= 0x071900
605
static void set_curl_keepalive(CURL *c)
606
{
960
#if LIBCURL_VERSION_NUM >= 0x073400
961
curl_easy_setopt(result, CURLOPT_PROXY_CAINFO, NULL);
962
#endif
927
- } else if (ssl_cainfo != NULL)
928
- curl_easy_setopt(result, CURLOPT_CAINFO, ssl_cainfo);
963
+ } else if (ssl_cainfo != NULL || http_proxy_ssl_ca_info != NULL) {
964
+ if (ssl_cainfo != NULL)
965
+ curl_easy_setopt(result, CURLOPT_CAINFO, ssl_cainfo);
966
+#if LIBCURL_VERSION_NUM >= 0x073400
967
+ if (http_proxy_ssl_ca_info != NULL)
968
+ curl_easy_setopt(result, CURLOPT_PROXY_CAINFO, http_proxy_ssl_ca_info);
969
+#endif
970
+ }
971
972
if (curl_low_speed_limit > 0 && curl_low_speed_time > 0) {
973
curl_easy_setopt(result, CURLOPT_LOW_SPEED_LIMIT,
1060
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
1061
#endif
1062
#if LIBCURL_VERSION_NUM >= 0x073400
1021
- else if (starts_with(curl_http_proxy, "https"))
1022
- curl_easy_setopt(result,
1023
- CURLOPT_PROXYTYPE, CURLPROXY_HTTPS);
1063
+ else if (starts_with(curl_http_proxy, "https")) {
1064
+ curl_easy_setopt(result, CURLOPT_PROXYTYPE, CURLPROXY_HTTPS);
1065
+
1066
+ if (http_proxy_ssl_cert)
1067
+ curl_easy_setopt(result, CURLOPT_PROXY_SSLCERT, http_proxy_ssl_cert);
1068
+
1069
+ if (http_proxy_ssl_key)
1070
+ curl_easy_setopt(result, CURLOPT_PROXY_SSLKEY, http_proxy_ssl_key);
1071
+
1072
+ if (has_proxy_cert_password())
1073
+ curl_easy_setopt(result, CURLOPT_PROXY_KEYPASSWD, proxy_cert_auth.password);
1074
+ }
1075
#endif
1076
if (strstr(curl_http_proxy, "://"))
1077
credential_from_url(&proxy_auth, curl_http_proxy);
1281
}
1282
ssl_cert_password_required = 0;
1283
1284
+ if (proxy_cert_auth.password != NULL) {
1285
+ memset(proxy_cert_auth.password, 0, strlen(proxy_cert_auth.password));
1286
+ FREE_AND_NULL(proxy_cert_auth.password);
1287
+ }
1288
+ proxy_ssl_cert_password_required = 0;
1289
+
1290
FREE_AND_NULL(cached_accept_language);
1291
}
1292