From 52ab540db5df5cc2c2d35d62369285ff2b4e2771 Mon Sep 17 00:00:00 2001 From: Jordan Callicoat Date: Sat, 11 Apr 2009 12:24:43 +0200 Subject: [PATCH] Teach magic_uri that hostnames don't contain spaces New test cases included. Two of them are commented out since they are not supported but should logcially be. --- midori/sokoke.c | 5 +++-- tests/magic-uri.c | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/midori/sokoke.c b/midori/sokoke.c index 09fc9f56..d791c879 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -243,8 +243,9 @@ sokoke_magic_uri (const gchar* uri, return sokoke_idn_to_punycode (g_strdup (uri)); /* Do we have a domain, ip address or localhost? */ - if ((search = strchr (uri, ':')) && search[0] && - !g_ascii_isalpha (search[1]) && search[1] != ' ') + search = NULL; + if (!strchr (uri, ' ') && (search = strchr (uri, ':')) && + search[0] && !g_ascii_isalpha (search[1])) if (!strchr (search, '.')) return sokoke_idn_to_punycode (g_strconcat ("http://", uri, NULL)); if (!strcmp (uri, "localhost") || g_str_has_prefix (uri, "localhost/")) diff --git a/tests/magic-uri.c b/tests/magic-uri.c index 4611959f..e0715399 100644 --- a/tests/magic-uri.c +++ b/tests/magic-uri.c @@ -75,6 +75,8 @@ magic_uri_uri (void) test_input ("192.168.1.1:8000", "http://192.168.1.1:8000"); test_input ("file:///home/mark/foo/bar.html", "file:///home/mark/foo/bar.html"); + /* test_input ("foo:123@bar.baz", "foo:123@bar.baz"); */ + /* test_input ("foo:foo@bar.baz", "foo:foo@bar.baz"); */ } static void @@ -130,6 +132,8 @@ magic_uri_search (void) test_input ("sm de.po verbose", SM "de.po verbose"); test_input ("sm warning: configure /dev/net: virtual", SM "warning: configure /dev/net: virtual"); + test_input ("g \"ISO 9001:2000 certified\"", NULL); + test_input ("g conference \"April 2, 7:00 am\"", NULL); } static void