提交 663699f4 authored 作者: Marc Olivier Chouinard's avatar Marc Olivier Chouinard

FS-2896 --resolve

上级 ab5f3f28
<configuration name="xml_curl.conf" description="cURL XML Gateway"> <configuration name="xml_curl.conf" description="cURL XML Gateway">
<bindings> <bindings>
<binding name="example"> <binding name="example">
<!-- Allow to bind on a particular IP for requests sent -->
<!--<param name="bind-local" value="$${local_ip_v4}" />-->
<!-- The url to a gateway cgi that can generate xml similar to <!-- The url to a gateway cgi that can generate xml similar to
what's in this file only on-the-fly (leave it commented if you dont what's in this file only on-the-fly (leave it commented if you dont
need it) --> need it) -->
......
...@@ -44,6 +44,7 @@ struct xml_binding { ...@@ -44,6 +44,7 @@ struct xml_binding {
char *url; char *url;
char *bindings; char *bindings;
char *cred; char *cred;
char *bind_local;
int disable100continue; int disable100continue;
int use_get_style; int use_get_style;
uint32_t enable_cacert_check; uint32_t enable_cacert_check;
...@@ -283,6 +284,10 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con ...@@ -283,6 +284,10 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
switch_curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE, binding->cookie_file); switch_curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE, binding->cookie_file);
} }
if (binding->bind_local) {
curl_easy_setopt(curl_handle, CURLOPT_INTERFACE, binding->bind_local);
}
switch_curl_easy_perform(curl_handle); switch_curl_easy_perform(curl_handle);
switch_curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes); switch_curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes);
switch_curl_easy_cleanup(curl_handle); switch_curl_easy_cleanup(curl_handle);
...@@ -348,6 +353,7 @@ static switch_status_t do_config(void) ...@@ -348,6 +353,7 @@ static switch_status_t do_config(void)
for (binding_tag = switch_xml_child(bindings_tag, "binding"); binding_tag; binding_tag = binding_tag->next) { for (binding_tag = switch_xml_child(bindings_tag, "binding"); binding_tag; binding_tag = binding_tag->next) {
char *bname = (char *) switch_xml_attr_soft(binding_tag, "name"); char *bname = (char *) switch_xml_attr_soft(binding_tag, "name");
char *url = NULL; char *url = NULL;
char *bind_local = NULL;
char *bind_cred = NULL; char *bind_cred = NULL;
char *bind_mask = NULL; char *bind_mask = NULL;
char *method = NULL; char *method = NULL;
...@@ -434,10 +440,13 @@ static switch_status_t do_config(void) ...@@ -434,10 +440,13 @@ static switch_status_t do_config(void)
need_vars_map = 1; need_vars_map = 1;
} }
if (vars_map && val) if (vars_map && val) {
if (switch_core_hash_insert(vars_map, val, ENABLE_PARAM_VALUE) != SWITCH_STATUS_SUCCESS) { if (switch_core_hash_insert(vars_map, val, ENABLE_PARAM_VALUE) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't add %s to params hash!\n", val); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't add %s to params hash!\n", val);
} }
}
} else if (!strcasecmp(var, "bind-local")) {
bind_local = val;
} }
} }
...@@ -460,6 +469,9 @@ static switch_status_t do_config(void) ...@@ -460,6 +469,9 @@ static switch_status_t do_config(void)
binding->url = strdup(url); binding->url = strdup(url);
switch_assert(binding->url); switch_assert(binding->url);
if (bind_local != NULL) {
binding->bind_local = strdup(bind_local);
}
if (method != NULL) { if (method != NULL) {
binding->method = strdup(method); binding->method = strdup(method);
} else { } else {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论