X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=http.c;h=ed59b79709b11dc6f6d85e86d75a1a8883799f21;hb=c6576f912fc34193a02d7ec587484f7c2ce3fe77;hp=1108ab4a3101fb4768cad420ccfdb52d87890a18;hpb=69b060c84e25c2cb90b16bd0ba602bc14102e1ae;p=git.git diff --git a/http.c b/http.c index 1108ab4a3..ed59b7970 100644 --- a/http.c +++ b/http.c @@ -165,7 +165,16 @@ static CURL* get_curl_handle(void) { CURL* result = curl_easy_init(); - curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, curl_ssl_verify); + if (!curl_ssl_verify) { + curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 0); + } else { + /* Verify authenticity of the peer's certificate */ + curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 1); + /* The name in the cert must match whom we tried to connect */ + curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2); + } + #if LIBCURL_VERSION_NUM >= 0x070907 curl_easy_setopt(result, CURLOPT_NETRC, CURL_NETRC_OPTIONAL); #endif @@ -402,7 +411,7 @@ static struct fill_chain *fill_cfg = NULL; void add_fill_function(void *data, int (*fill)(void *)) { - struct fill_chain *new = malloc(sizeof(*new)); + struct fill_chain *new = xmalloc(sizeof(*new)); struct fill_chain **linkp = &fill_cfg; new->data = data; new->fill = fill;