http.c: Use 'git_config_string' to clean up SSL config.
Signed-off-by: Brian Hetro <whee@smaertness.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brian Hetro committed
Jul 5, 2008 at 01:24 UTC
7ef8ea7035a3be4a97259e53e8dd3c1b8fd81ac0
1 file changed
+12
-24
http.c
+12
-24
@@ -13,14 +13,14 @@ static CURL *curl_default;
13
char curl_errorstr[CURL_ERROR_SIZE];
14
15
static int curl_ssl_verify = -1;
16
-static char *ssl_cert = NULL;
16
+static const char *ssl_cert = NULL;
17
#if LIBCURL_VERSION_NUM >= 0x070902
18
-static char *ssl_key = NULL;
18
+static const char *ssl_key = NULL;
19
#endif
20
#if LIBCURL_VERSION_NUM >= 0x070908
21
-static char *ssl_capath = NULL;
21
+static const char *ssl_capath = NULL;
22
#endif
23
-static char *ssl_cainfo = NULL;
23
+static const char *ssl_cainfo = NULL;
24
static long curl_low_speed_limit = -1;
25
static long curl_low_speed_time = -1;
26
static int curl_ftp_no_epsv = 0;
@@ -101,39 +101,27 @@ static int http_options(const char *var, const char *value, void *cb)
101
}
102
103
if (!strcmp("http.sslcert", var)) {
104
- if (ssl_cert == NULL) {
105
- if (!value)
106
- return config_error_nonbool(var);
107
- ssl_cert = xstrdup(value);
108
- }
104
+ if (ssl_cert == NULL)
105
+ return git_config_string(&ssl_cert, var, value);
106
return 0;
107
}
108
#if LIBCURL_VERSION_NUM >= 0x070902
109
if (!strcmp("http.sslkey", var)) {
113
- if (ssl_key == NULL) {
114
- if (!value)
115
- return config_error_nonbool(var);
116
- ssl_key = xstrdup(value);
117
- }
110
+ if (ssl_key == NULL)
111
+ return git_config_string(&ssl_key, var, value);
112
return 0;
113
}
114
#endif
115
#if LIBCURL_VERSION_NUM >= 0x070908
116
if (!strcmp("http.sslcapath", var)) {
123
- if (ssl_capath == NULL) {
124
- if (!value)
125
- return config_error_nonbool(var);
126
- ssl_capath = xstrdup(value);
127
- }
117
+ if (ssl_capath == NULL)
118
+ return git_config_string(&ssl_capath, var, value);
119
return 0;
120
}
121
#endif
122
if (!strcmp("http.sslcainfo", var)) {
132
- if (ssl_cainfo == NULL) {
133
- if (!value)
134
- return config_error_nonbool(var);
135
- ssl_cainfo = xstrdup(value);
136
- }
123
+ if (ssl_cainfo == NULL)
124
+ return git_config_string(&ssl_cainfo, var, value);
125
return 0;
126
}
127