add better debug line to xml_curl

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6860 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-12-18 14:16:43 +00:00
parent 13c02c87d8
commit b13611b1bd

View File

@ -128,16 +128,14 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
return xml;
}
if (!(data = switch_mprintf("hostname=%s&section=%s&tag_name=%s&key_name=%s&key_value=%s%s%s",
data = switch_mprintf("hostname=%s&section=%s&tag_name=%s&key_name=%s&key_value=%s%s%s",
hostname,
section,
tag_name ? tag_name : "",
key_name ? key_name : "",
key_value ? key_value : "", params ? strchr(params, '=') ? "&" : "&params=" : "", params ? params : ""))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
return NULL;
}
switch_str_nil(tag_name),
switch_str_nil(key_name),
switch_str_nil(key_value),
params ? strchr(params, '=') ? "&" : "&params=" : "", params ? params : "");
switch_assert(data);
switch_uuid_get(&uuid);
switch_uuid_format(uuid_str, &uuid);
@ -183,14 +181,12 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening temp file!\n");
}
switch_safe_free(data);
if (httpRes == 200) {
if (!(xml = switch_xml_parse_file(filename))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing Result!\n");
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received HTTP error %ld trying to fetch %s\n",httpRes,key_value);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received HTTP error %ld trying to fetch %s\ndata: [%s]\n", httpRes, binding->url, data);
xml = NULL;
}
@ -203,6 +199,8 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
}
}
switch_safe_free(data);
return xml;
}