Add cacert option for Curl plugin. Allows to set cacert for curl lib (#3)
Add cacert option for curl plugin add cacert option for Curl plugin. Allows to set cacert for curl lib Added documentation line into doc/plugins.rst with explanation for cacert option
This commit is contained in:
@@ -148,6 +148,8 @@ static struct curl_slist *http_200_aliases;
|
||||
/** HTTP proxy settings */
|
||||
static const char *proxy, *proxy_user, *proxy_password;
|
||||
static unsigned proxy_port;
|
||||
/** CA CERT settings*/
|
||||
static const char *cacert;
|
||||
|
||||
static bool verify_peer, verify_host;
|
||||
|
||||
@@ -375,7 +377,7 @@ input_curl_init(EventLoop &event_loop, const ConfigBlock &block)
|
||||
#else
|
||||
constexpr bool default_verify = true;
|
||||
#endif
|
||||
|
||||
cacert = block.GetBlockValue("cacert");
|
||||
verify_peer = block.GetBlockValue("verify_peer", default_verify);
|
||||
verify_host = block.GetBlockValue("verify_host", default_verify);
|
||||
}
|
||||
@@ -432,6 +434,8 @@ CurlInputStream::InitEasy()
|
||||
StringFormat<1024>("%s:%s", proxy_user,
|
||||
proxy_password).c_str());
|
||||
|
||||
if (cacert != nullptr)
|
||||
request->SetOption(CURLOPT_CAINFO, cacert);
|
||||
request->SetVerifyPeer(verify_peer);
|
||||
request->SetVerifyHost(verify_host);
|
||||
request->SetOption(CURLOPT_HTTPHEADER, request_headers.Get());
|
||||
|
Reference in New Issue
Block a user