# HG changeset patch
# User rosfran
# Date 1173314025 0
# Node ID 0a187bf1e9afa373b2d0c32e106dcc599de51806
# Parent  8712835e34cc6833710fe0bfacecbc25bc5ee84f
[svn r406] Some new tests with escaped URI parameters.

diff -r 8712835e34cc -r 0a187bf1e9af gmyth/src/gmyth_http.c
--- a/gmyth/src/gmyth_http.c	Wed Mar 07 23:28:36 2007 +0000
+++ b/gmyth/src/gmyth_http.c	Thu Mar 08 00:33:45 2007 +0000
@@ -33,6 +33,7 @@
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 #include <libxml/xpath.h>
+#include <libxml/uri.h>
 
 #include "gmyth_http.h"
 #include "gmyth_debug.h"
@@ -247,15 +248,16 @@
     chunk.size = 0;    /* no data at this point */
 
     gchar* starttime;
-    starttime = gmyth_util_time_to_mythformat_from_time_val(StartTime);
+    starttime = (gchar*)xmlURIEscapeStr( (const xmlChar*)gmyth_util_time_to_mythformat_from_time_val(StartTime), NULL );
 
     gchar* endtime;
-    endtime = gmyth_util_time_to_mythformat_from_time_val(EndTime);
+    endtime = (gchar*)xmlURIEscapeStr( (const xmlChar*)gmyth_util_time_to_mythformat_from_time_val(EndTime), NULL );
 
     GString* command = g_string_new("");
     g_string_printf(command, "getProgramGuide?StartTime=%s&EndTime=%s&StartChanId=%d" \
             "&NumOfChannels=%d&Details=%s", starttime, endtime, \
             StartChanId, NumOfChannels, Details );
+    gmyth_debug ( "HTTP Request command = %s\n", command->str );
 
     chunk = gmyth_http_request(backend_info, command);
     if (chunk.memory != NULL)
@@ -800,16 +802,16 @@
                                  GString *command)
 {
     LIBXML_TEST_VERSION
-
+    
     size_t size = strlen(backend_info->hostname) + \
-      strlen(command->str) + 14;
+      strlen(command->str) + 14;      
 
     gchar *URL = (gchar *)g_malloc(sizeof(gchar)*size);
     g_snprintf(URL, size, "http://%s:%d/%s", \
            backend_info->hostname, \
            backend_info->status_port, \
            command->str);
-
+    
     CURL *curl_handle;
 
     MemoryStruct chunk;
diff -r 8712835e34cc -r 0a187bf1e9af gmyth/tests/gmyth_test_http.c
--- a/gmyth/tests/gmyth_test_http.c	Wed Mar 07 23:28:36 2007 +0000
+++ b/gmyth/tests/gmyth_test_http.c	Thu Mar 08 00:33:45 2007 +0000
@@ -16,9 +16,12 @@
     gmyth_backend_info_set_status_port (backend_info, 6544);
     
     GTimeVal* start = gmyth_util_string_to_time_val("2006-01-01T00:00");
-    GTimeVal* end = gmyth_util_string_to_time_val("2007-01-01T00:00");
+    GTimeVal* end = gmyth_util_string_to_time_val("2007-03-10T00:00");
     GMythEpg epg;
-    epg  = gmyth_http_retrieve_epg(backend_info, start, end, 0, 2, "True");
+    epg  = gmyth_http_retrieve_epg(backend_info, start, end, 1000, 1000, "True");
+
+    if ( NULL == epg.channelList || g_slist_length( epg.channelList ) <= 0 )
+    	printf( "Channel list is empty!!!" );
  
     //GMythRecorded recorded;
     //recorded = gmyth_http_retrieve_recorded(backend_info);