Allow "g cache:127.0.0.1" to search from the location

This commit is contained in:
Christian Dywan 2008-11-18 06:37:11 +01:00
parent e505942314
commit 56d26b02e5
2 changed files with 7 additions and 2 deletions

View file

@ -115,8 +115,10 @@ sokoke_magic_uri (const gchar* uri,
{ {
/* Do we have a domain, ip address or localhost? */ /* Do we have a domain, ip address or localhost? */
search = strchr (uri, ':'); search = strchr (uri, ':');
if ((search && search[0] && !g_ascii_isalpha (search[1])) if (search && search[0] && !g_ascii_isalpha (search[1]))
|| !strcmp (uri, "localhost")) if (!strchr (search, '.'))
return g_strconcat ("http://", uri, NULL);
if (!strcmp (uri, "localhost"))
return g_strconcat ("http://", uri, NULL); return g_strconcat ("http://", uri, NULL);
parts = g_strsplit (uri, ".", 0); parts = g_strsplit (uri, ".", 0);
if (!search && parts[0] && parts[1]) if (!search && parts[0] && parts[1])

View file

@ -72,6 +72,9 @@ main (int argc,
test_input ("midori 0.1.0", NULL); test_input ("midori 0.1.0", NULL);
test_input ("search:cats", NULL); test_input ("search:cats", NULL);
test_input ("search:twotoasts.de", NULL); test_input ("search:twotoasts.de", NULL);
test_input ("g cache:127.0.0.1", NULL);
test_input ("g cache:127.0.0.1/foo", NULL);
test_input ("g cache:twotoats.de/foo", NULL);
return 0; return 0;
} }