From 993fb526440bb5db8d45ff0b90367231db8f1596 Mon Sep 17 00:00:00 2001 From: Arnaud Renevier Date: Sat, 20 Dec 2008 00:24:35 +0100 Subject: [PATCH] Allow relative localhost URIs --- midori/sokoke.c | 2 +- tests/magic-uri.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/midori/sokoke.c b/midori/sokoke.c index adcddb73..e425b9d2 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -121,7 +121,7 @@ sokoke_magic_uri (const gchar* uri, if (search && search[0] && !g_ascii_isalpha (search[1])) if (!strchr (search, '.')) return g_strconcat ("http://", uri, NULL); - if (!strcmp (uri, "localhost")) + if (!strcmp (uri, "localhost") || g_str_has_prefix (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 3a8dbafa..7fda317a 100644 --- a/tests/magic-uri.c +++ b/tests/magic-uri.c @@ -60,6 +60,7 @@ main (int argc, g_free (b); test_input ("localhost", "http://localhost"); test_input ("localhost:8000", "http://localhost:8000"); + test_input ("localhost/rss", "http://localhost/rss"); test_input ("192.168.1.1", "http://192.168.1.1"); test_input ("192.168.1.1:8000", "http://192.168.1.1:8000"); test_input ("sm midori", SM "midori");