aboutsummaryrefslogtreecommitdiffstats
path: root/src/input/plugins/CurlInputPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-07-11 16:39:42 +0200
committerMax Kellermann <max@duempel.org>2014-07-11 16:39:42 +0200
commit681643ea9e6e196c449f1974cd50e1f400da3450 (patch)
tree32f741a1d1c60bbf1132fbef90f7de5d179d41e2 /src/input/plugins/CurlInputPlugin.cxx
parentfa947e02ca0b2806990d23dae2f6e7421c74978c (diff)
downloadmpd-681643ea9e6e196c449f1974cd50e1f400da3450.tar.gz
mpd-681643ea9e6e196c449f1974cd50e1f400da3450.tar.xz
mpd-681643ea9e6e196c449f1974cd50e1f400da3450.zip
input/curl: options "verify_peer" and "verify_host"
Diffstat (limited to '')
-rw-r--r--src/input/plugins/CurlInputPlugin.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/input/plugins/CurlInputPlugin.cxx b/src/input/plugins/CurlInputPlugin.cxx
index 46961d08f..4d7671cc2 100644
--- a/src/input/plugins/CurlInputPlugin.cxx
+++ b/src/input/plugins/CurlInputPlugin.cxx
@@ -245,6 +245,8 @@ static struct curl_slist *http_200_aliases;
static const char *proxy, *proxy_user, *proxy_password;
static unsigned proxy_port;
+static bool verify_peer, verify_host;
+
static CurlMulti *curl_multi;
static constexpr Domain http_domain("http");
@@ -562,6 +564,9 @@ input_curl_init(const config_param &param, Error &error)
"");
}
+ verify_peer = param.GetBlockValue("verify_peer", true);
+ verify_host = param.GetBlockValue("verify_host", true);
+
CURLM *multi = curl_multi_init();
if (multi == nullptr) {
curl_slist_free_all(http_200_aliases);
@@ -740,6 +745,9 @@ CurlInputStream::InitEasy(Error &error)
curl_easy_setopt(easy, CURLOPT_PROXYUSERPWD, proxy_auth_str);
}
+ curl_easy_setopt(easy, CURLOPT_SSL_VERIFYPEER, verify_peer ? 1l : 0l);
+ curl_easy_setopt(easy, CURLOPT_SSL_VERIFYHOST, verify_host ? 2l : 0l);
+
CURLcode code = curl_easy_setopt(easy, CURLOPT_URL, GetURI());
if (code != CURLE_OK) {
error.Format(curl_domain, code,