Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions conf/vanilla/autoload_configs/xml_curl.conf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<binding name="example">
<!-- Allow to bind on a particular IP for requests sent -->
<!--<param name="bind-local" value="$${local_ip_v4}" />-->
<!-- Connect directly to UNIX socket -->
<!-- <param name="gateway-unix-socket-path" value="/run/lighttpd.socket"/>-->
<!-- 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) -->
Expand Down
12 changes: 12 additions & 0 deletions src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ SWITCH_MODULE_DEFINITION(mod_xml_curl, mod_xml_curl_load, mod_xml_curl_shutdown,
struct xml_binding {
char *method;
char *url;
char *unix_socket_path;
char *bindings;
char *cred;
char *bind_local;
Expand Down Expand Up @@ -220,6 +221,10 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
curl_handle = switch_curl_easy_init();
headers = switch_curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");

if (binding->unix_socket_path) {
curl_easy_setopt(curl_handle, CURLOPT_UNIX_SOCKET_PATH, binding->unix_socket_path);
}

if (!strncasecmp(binding->url, "https", 5)) {
switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
Expand Down Expand Up @@ -367,6 +372,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_unix_socket_path = NULL;
char *bind_local = NULL;
char *bind_cred = NULL;
char *bind_mask = NULL;
Expand Down Expand Up @@ -397,6 +403,8 @@ static switch_status_t do_config(void)
if (val) {
url = val;
}
} else if (!strcasecmp(var, "gateway-unix-socket-path")) {
bind_unix_socket_path = val;
} else if (!strcasecmp(var, "gateway-credentials")) {
bind_cred = val;
} else if (!strcasecmp(var, "auth-scheme")) {
Expand Down Expand Up @@ -491,6 +499,10 @@ static switch_status_t do_config(void)
binding->url = switch_core_strdup(globals.pool, url);
switch_assert(binding->url);

if (bind_unix_socket_path) {
binding->unix_socket_path = switch_core_strdup(globals.pool, bind_unix_socket_path);
}

if (bind_local != NULL) {
binding->bind_local = switch_core_strdup(globals.pool, bind_local);
}
Expand Down
Loading