提交 e008b1be authored 作者: Justin Cassidy's avatar Justin Cassidy

add option to mod_xml_cdr to ignore ca root checks on https urls

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5810 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 4fbcb206
...@@ -20,5 +20,9 @@ ...@@ -20,5 +20,9 @@
<!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank or omitted value will default to ${prefix}/logs/xml_cdr --> <!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank or omitted value will default to ${prefix}/logs/xml_cdr -->
<!-- <param name="err-log-dir" value="/tmp"/> --> <!-- <param name="err-log-dir" value="/tmp"/> -->
<!-- optional: if enabled this will disable CA root certificate checks by libcurl -->
<!-- note: default value is disabled. only enable if you want this! -->
<!-- <param name="ignore-cacert-check" value="true" /> -->
</settings> </settings>
</configuration> </configuration>
...@@ -41,6 +41,7 @@ static struct { ...@@ -41,6 +41,7 @@ static struct {
uint32_t delay; uint32_t delay;
uint32_t retries; uint32_t retries;
uint32_t shutdown; uint32_t shutdown;
int ignore_cacert_check;
} globals; } globals;
SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load); SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load);
...@@ -133,6 +134,10 @@ static switch_status_t my_on_hangup(switch_core_session_t *session) ...@@ -133,6 +134,10 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-xml/1.0"); curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-xml/1.0");
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, httpCallBack); curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, httpCallBack);
if (globals.ignore_cacert_check) {
curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);
}
/* these were used for testing, optionally they may be enabled if someone desires /* these were used for testing, optionally they may be enabled if someone desires
curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 120); // tcp timeout curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 120); // tcp timeout
curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); // 302 recursion level curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); // 302 recursion level
...@@ -257,6 +262,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load) ...@@ -257,6 +262,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load)
globals.err_log_dir = switch_mprintf("%s/%s", SWITCH_GLOBAL_dirs.log_dir, val); globals.err_log_dir = switch_mprintf("%s/%s", SWITCH_GLOBAL_dirs.log_dir, val);
} }
} }
} else if (!strcasecmp(var, "ignore-cacert-check") && switch_true(val)) {
globals.ignore_cacert_check = 1;
} }
if (switch_strlen_zero(globals.err_log_dir)) { if (switch_strlen_zero(globals.err_log_dir)) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论