[Freeswitch-svn] [commit] r5554 - freeswitch/trunk/src/mod/xml_int/mod_xml_curl

Freeswitch SVN mikej at freeswitch.org
Fri Aug 3 00:21:29 EDT 2007


Author: mikej
Date: Fri Aug  3 00:21:29 2007
New Revision: 5554

Modified:
   freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c

Log:
fix for MDXMLINT-8

Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
==============================================================================
--- freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c	(original)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c	Fri Aug  3 00:21:29 2007
@@ -72,6 +72,7 @@
 	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 @@
 		}
 
 		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 @@
 
 	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);



More information about the Freeswitch-svn mailing list