[svn r406] Some new tests with escaped URI parameters. trunk
authorrosfran
Thu Mar 08 00:33:45 2007 +0000 (2007-03-08)
branchtrunk
changeset 4010a187bf1e9af
parent 400 8712835e34cc
child 402 74c9ba2e13ec
[svn r406] Some new tests with escaped URI parameters.
gmyth/src/gmyth_http.c
gmyth/tests/gmyth_test_http.c
     1.1 --- a/gmyth/src/gmyth_http.c	Wed Mar 07 23:28:36 2007 +0000
     1.2 +++ b/gmyth/src/gmyth_http.c	Thu Mar 08 00:33:45 2007 +0000
     1.3 @@ -33,6 +33,7 @@
     1.4  #include <libxml/parser.h>
     1.5  #include <libxml/tree.h>
     1.6  #include <libxml/xpath.h>
     1.7 +#include <libxml/uri.h>
     1.8  
     1.9  #include "gmyth_http.h"
    1.10  #include "gmyth_debug.h"
    1.11 @@ -247,15 +248,16 @@
    1.12      chunk.size = 0;    /* no data at this point */
    1.13  
    1.14      gchar* starttime;
    1.15 -    starttime = gmyth_util_time_to_mythformat_from_time_val(StartTime);
    1.16 +    starttime = (gchar*)xmlURIEscapeStr( (const xmlChar*)gmyth_util_time_to_mythformat_from_time_val(StartTime), NULL );
    1.17  
    1.18      gchar* endtime;
    1.19 -    endtime = gmyth_util_time_to_mythformat_from_time_val(EndTime);
    1.20 +    endtime = (gchar*)xmlURIEscapeStr( (const xmlChar*)gmyth_util_time_to_mythformat_from_time_val(EndTime), NULL );
    1.21  
    1.22      GString* command = g_string_new("");
    1.23      g_string_printf(command, "getProgramGuide?StartTime=%s&EndTime=%s&StartChanId=%d" \
    1.24              "&NumOfChannels=%d&Details=%s", starttime, endtime, \
    1.25              StartChanId, NumOfChannels, Details );
    1.26 +    gmyth_debug ( "HTTP Request command = %s\n", command->str );
    1.27  
    1.28      chunk = gmyth_http_request(backend_info, command);
    1.29      if (chunk.memory != NULL)
    1.30 @@ -800,16 +802,16 @@
    1.31                                   GString *command)
    1.32  {
    1.33      LIBXML_TEST_VERSION
    1.34 -
    1.35 +    
    1.36      size_t size = strlen(backend_info->hostname) + \
    1.37 -      strlen(command->str) + 14;
    1.38 +      strlen(command->str) + 14;      
    1.39  
    1.40      gchar *URL = (gchar *)g_malloc(sizeof(gchar)*size);
    1.41      g_snprintf(URL, size, "http://%s:%d/%s", \
    1.42             backend_info->hostname, \
    1.43             backend_info->status_port, \
    1.44             command->str);
    1.45 -
    1.46 +    
    1.47      CURL *curl_handle;
    1.48  
    1.49      MemoryStruct chunk;
     2.1 --- a/gmyth/tests/gmyth_test_http.c	Wed Mar 07 23:28:36 2007 +0000
     2.2 +++ b/gmyth/tests/gmyth_test_http.c	Thu Mar 08 00:33:45 2007 +0000
     2.3 @@ -16,9 +16,12 @@
     2.4      gmyth_backend_info_set_status_port (backend_info, 6544);
     2.5      
     2.6      GTimeVal* start = gmyth_util_string_to_time_val("2006-01-01T00:00");
     2.7 -    GTimeVal* end = gmyth_util_string_to_time_val("2007-01-01T00:00");
     2.8 +    GTimeVal* end = gmyth_util_string_to_time_val("2007-03-10T00:00");
     2.9      GMythEpg epg;
    2.10 -    epg  = gmyth_http_retrieve_epg(backend_info, start, end, 0, 2, "True");
    2.11 +    epg  = gmyth_http_retrieve_epg(backend_info, start, end, 1000, 1000, "True");
    2.12 +
    2.13 +    if ( NULL == epg.channelList || g_slist_length( epg.channelList ) <= 0 )
    2.14 +    	printf( "Channel list is empty!!!" );
    2.15   
    2.16      //GMythRecorded recorded;
    2.17      //recorded = gmyth_http_retrieve_recorded(backend_info);