FS-2896 --resolve

This commit is contained in:
Marc Olivier Chouinard 2011-12-18 01:48:35 -05:00
parent ab5f3f2897
commit 663699f4e3
2 changed files with 15 additions and 1 deletions

View File

@ -1,6 +1,8 @@
<configuration name="xml_curl.conf" description="cURL XML Gateway">
<bindings>
<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
what's in this file only on-the-fly (leave it commented if you dont
need it) -->

View File

@ -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 {