[svn r281] Fixes in the gmyth_uri path and query parsing.
1.1 --- a/gmyth/src/gmyth_backendinfo.c Fri Jan 19 18:05:58 2007 +0000
1.2 +++ b/gmyth/src/gmyth_backendinfo.c Fri Jan 19 18:38:22 2007 +0000
1.3 @@ -125,12 +125,17 @@
1.4
1.5 GMythURI* uri = gmyth_uri_new_with_value( uri_str );
1.6
1.7 + gchar** path_parts = g_strsplit( gmyth_uri_get_path( uri ), "&", -1 );
1.8 +
1.9 gmyth_backend_info_set_hostname (backend_info, gmyth_uri_get_host (uri ) );
1.10 gmyth_backend_info_set_username (backend_info, gmyth_uri_get_user( uri ) );
1.11 gmyth_backend_info_set_password (backend_info, gmyth_uri_get_password( uri ) );
1.12 - gmyth_backend_info_set_db_name (backend_info, strlen( gmyth_uri_get_fragment( uri ) ) > 0
1.13 - ? gmyth_uri_get_fragment( uri ) : gmyth_uri_get_query( uri ) );
1.14 + /* gets the path info to database name, from the URI, and removes the trash chars */
1.15 + gmyth_backend_info_set_db_name (backend_info, path_parts != NULL && path_parts[0] != NULL
1.16 + && strlen( path_parts[0] ) > 0 ? g_strstrip( g_strdelimit( path_parts[0], "/?", ' ' ) ) : gmyth_uri_get_path( uri ) );
1.17 gmyth_backend_info_set_port (backend_info, gmyth_uri_get_port( uri ) );
1.18 +
1.19 + g_strfreev( path_parts );
1.20
1.21 return backend_info;
1.22 }
2.1 --- a/gmyth/src/gmyth_uri.c Fri Jan 19 18:05:58 2007 +0000
2.2 +++ b/gmyth/src/gmyth_uri.c Fri Jan 19 18:38:22 2007 +0000
2.3 @@ -274,8 +274,8 @@
2.4 /**** port ****/
2.5 portStr = g_string_new_len (hostStr->str+colonIdx+1, hostLen-colonIdx-1);
2.6 uri->port = (gint)g_ascii_strtoull( portStr->str, NULL, 10 );
2.7 - g_string_free (portStr, FALSE);
2.8 - g_string_free (hostStr, FALSE);
2.9 + g_string_free (portStr, TRUE);
2.10 + g_string_free (hostStr, TRUE);
2.11 }
2.12 else {
2.13 const gchar* protocol = gmyth_uri_get_protocol(uri);