From 56d26b02e52810579b537269c6ffb4c70de23e33 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Tue, 18 Nov 2008 06:37:11 +0100 Subject: [PATCH] Allow "g cache:127.0.0.1" to search from the location --- midori/sokoke.c | 6 ++++-- tests/magic-uri.c | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/midori/sokoke.c b/midori/sokoke.c index d170e5b9..e052fbfd 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -115,8 +115,10 @@ sokoke_magic_uri (const gchar* uri, { /* Do we have a domain, ip address or localhost? */ search = strchr (uri, ':'); - if ((search && search[0] && !g_ascii_isalpha (search[1])) - || !strcmp (uri, "localhost")) + if (search && search[0] && !g_ascii_isalpha (search[1])) + if (!strchr (search, '.')) + return g_strconcat ("http://", uri, NULL); + if (!strcmp (uri, "localhost")) return g_strconcat ("http://", uri, NULL); parts = g_strsplit (uri, ".", 0); if (!search && parts[0] && parts[1]) diff --git a/tests/magic-uri.c b/tests/magic-uri.c index 0685f3d8..5623f200 100644 --- a/tests/magic-uri.c +++ b/tests/magic-uri.c @@ -72,6 +72,9 @@ main (int argc, test_input ("midori 0.1.0", NULL); test_input ("search:cats", 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; } -- 2.39.5