# HG changeset patch # User rosfran # Date 1169231902 0 # Node ID e5199e48abecf2a73b3049fafbeb2cfb356108c1 # Parent 5a224299ab370d353d30621c403e74e1c70e4a2f [svn r281] Fixes in the gmyth_uri path and query parsing. diff -r 5a224299ab37 -r e5199e48abec gmyth/src/gmyth_backendinfo.c --- a/gmyth/src/gmyth_backendinfo.c Fri Jan 19 18:05:58 2007 +0000 +++ b/gmyth/src/gmyth_backendinfo.c Fri Jan 19 18:38:22 2007 +0000 @@ -125,12 +125,17 @@ GMythURI* uri = gmyth_uri_new_with_value( uri_str ); + gchar** path_parts = g_strsplit( gmyth_uri_get_path( uri ), "&", -1 ); + gmyth_backend_info_set_hostname (backend_info, gmyth_uri_get_host (uri ) ); gmyth_backend_info_set_username (backend_info, gmyth_uri_get_user( uri ) ); gmyth_backend_info_set_password (backend_info, gmyth_uri_get_password( uri ) ); - gmyth_backend_info_set_db_name (backend_info, strlen( gmyth_uri_get_fragment( uri ) ) > 0 - ? gmyth_uri_get_fragment( uri ) : gmyth_uri_get_query( uri ) ); + /* gets the path info to database name, from the URI, and removes the trash chars */ + gmyth_backend_info_set_db_name (backend_info, path_parts != NULL && path_parts[0] != NULL + && strlen( path_parts[0] ) > 0 ? g_strstrip( g_strdelimit( path_parts[0], "/?", ' ' ) ) : gmyth_uri_get_path( uri ) ); gmyth_backend_info_set_port (backend_info, gmyth_uri_get_port( uri ) ); + + g_strfreev( path_parts ); return backend_info; } diff -r 5a224299ab37 -r e5199e48abec gmyth/src/gmyth_uri.c --- a/gmyth/src/gmyth_uri.c Fri Jan 19 18:05:58 2007 +0000 +++ b/gmyth/src/gmyth_uri.c Fri Jan 19 18:38:22 2007 +0000 @@ -274,8 +274,8 @@ /**** port ****/ portStr = g_string_new_len (hostStr->str+colonIdx+1, hostLen-colonIdx-1); uri->port = (gint)g_ascii_strtoull( portStr->str, NULL, 10 ); - g_string_free (portStr, FALSE); - g_string_free (hostStr, FALSE); + g_string_free (portStr, TRUE); + g_string_free (hostStr, TRUE); } else { const gchar* protocol = gmyth_uri_get_protocol(uri);