From 591f098a1472d8b82ac67647e65cc0f9245965d4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 23 Jan 2008 21:14:38 +0000 Subject: [PATCH] change xml_lookups to take an event as params instead of url string this will break your xml_curl scripts please update git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7334 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/xml_int/mod_xml_curl/mod_xml_curl.c | 3 +- src/switch_event.c | 33 +++++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) 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 f1c73d1865..94bad3e412 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 @@ -138,9 +138,8 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con switch_str_nil(key_value)); data = switch_event_build_param_string(params, basic_data); - switch_assert(data); - printf("XXXXXXXXXXXXXXXXXXXX\n%s\n", data); + switch_uuid_get(&uuid); switch_uuid_format(uuid_str, &uuid); diff --git a/src/switch_event.c b/src/switch_event.c index bc5b3bff4a..b1170fc1c9 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -1310,28 +1310,29 @@ SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, co stream.write_function(&stream, "%s=%s&", prof_names[x], encode_buf); } - if ((hi = event->headers)) { - for (; hi; hi = hi->next) { - char *var = hi->name; - char *val = hi->value; + if (event) { + if ((hi = event->headers)) { + for (; hi; hi = hi->next) { + char *var = hi->name; + char *val = hi->value; - new_len = (strlen((char *) var) * 3) + 1; - if (encode_len < new_len) { - char *tmp; + new_len = (strlen((char *) var) * 3) + 1; + if (encode_len < new_len) { + char *tmp; - encode_len = new_len; + encode_len = new_len; - tmp = realloc(encode_buf, encode_len); - switch_assert(tmp); - encode_buf = tmp; + tmp = realloc(encode_buf, encode_len); + switch_assert(tmp); + encode_buf = tmp; + } + + switch_url_encode((char *) val, encode_buf, encode_len - 1); + stream.write_function(&stream, "%s=%s&", (char *) var, encode_buf); + } - - switch_url_encode((char *) val, encode_buf, encode_len - 1); - stream.write_function(&stream, "%s=%s&", (char *) var, encode_buf); - } } - e = (char *) stream.data + (strlen((char *) stream.data) - 1); if (e && *e == '&') {