From 7ad93226861a4561e5190c26ae0ab15270487ef4 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Fri, 3 Aug 2007 04:21:29 +0000 Subject: [PATCH] fix for MDXMLINT-8 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5554 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/xml_int/mod_xml_curl/mod_xml_curl.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 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 6559da33bd..d61941d525 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 @@ -72,6 +72,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con xml_binding_t *binding = (xml_binding_t *) user_data; char *file_url; struct curl_slist *slist = NULL; + long httpRes; if (!binding) { return NULL; @@ -126,6 +127,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con } curl_easy_perform(curl_handle); + curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE,&httpRes); curl_easy_cleanup(curl_handle); close(config_data.fd); } else { @@ -134,8 +136,13 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con switch_safe_free(data); - if (!(xml = switch_xml_parse_file(filename))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing Result!\n"); + 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); + xml=NULL; } unlink(filename);