From 663699f4e33903472b3b9629e073a556910e77aa Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Sun, 18 Dec 2011 01:48:35 -0500 Subject: [PATCH] FS-2896 --resolve --- conf/autoload_configs/xml_curl.conf.xml | 2 ++ src/mod/xml_int/mod_xml_curl/mod_xml_curl.c | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/conf/autoload_configs/xml_curl.conf.xml b/conf/autoload_configs/xml_curl.conf.xml index 21e0af6b68..30951d83c8 100644 --- a/conf/autoload_configs/xml_curl.conf.xml +++ b/conf/autoload_configs/xml_curl.conf.xml @@ -1,6 +1,8 @@ + + diff --git a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c index 0ba450b726..e5fa3ff032 100644 --- a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c +++ b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c @@ -44,6 +44,7 @@ struct xml_binding { char *url; char *bindings; char *cred; + char *bind_local; int disable100continue; int use_get_style; uint32_t enable_cacert_check; @@ -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); } + if (binding->bind_local) { + curl_easy_setopt(curl_handle, CURLOPT_INTERFACE, binding->bind_local); + } + switch_curl_easy_perform(curl_handle); switch_curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes); switch_curl_easy_cleanup(curl_handle); @@ -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) { char *bname = (char *) switch_xml_attr_soft(binding_tag, "name"); char *url = NULL; + char *bind_local = NULL; char *bind_cred = NULL; char *bind_mask = NULL; char *method = NULL; @@ -434,10 +440,13 @@ static switch_status_t do_config(void) 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) { 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) binding->url = strdup(url); switch_assert(binding->url); + if (bind_local != NULL) { + binding->bind_local = strdup(bind_local); + } if (method != NULL) { binding->method = strdup(method); } else {