Merge pull request #1370 from whatdoineed2do/http-optional-sslpeerverify

[http,conf] allow user to request no ssl peer verification
This commit is contained in:
ejurgensen 2021-12-18 23:56:33 +01:00 committed by GitHub
commit 6ee2302133
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -69,6 +69,7 @@ static cfg_opt_t sec_general[] =
CFG_INT("db_pragma_synchronous", -1, CFGF_NONE),
CFG_STR("allow_origin", "*", CFGF_NONE),
CFG_STR("user_agent", PACKAGE_NAME "/" PACKAGE_VERSION, CFGF_NONE),
CFG_BOOL("ssl_verifypeer", cfg_true, CFGF_NONE),
CFG_BOOL("timer_test", cfg_false, CFGF_NONE),
CFG_END()
};

View File

@ -102,6 +102,7 @@ http_client_request(struct http_client_ctx *ctx)
struct curl_slist *headers;
struct onekeyval *okv;
const char *user_agent;
long verifypeer;
char header[1024];
long response_code;
@ -116,6 +117,9 @@ http_client_request(struct http_client_ctx *ctx)
curl_easy_setopt(curl, CURLOPT_USERAGENT, user_agent);
curl_easy_setopt(curl, CURLOPT_URL, ctx->url);
verifypeer = cfg_getbool(cfg_getsec(cfg, "general"), "ssl_verifypeer");
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, verifypeer);
headers = NULL;
if (ctx->output_headers)
{