aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorXan Lopez <xan@igalia.com>2012-08-17 23:24:36 +0800
committerXan Lopez <xan@igalia.com>2012-08-17 23:25:06 +0800
commit70b9a089b39208856f73e26d533d4912bb37050d (patch)
treeba2f226a891da13f747f2271057d9ee86d145baa /lib
parentcf9c1a366b1424ee55e621302c5cba02803832a8 (diff)
downloadgsoc2013-epiphany-70b9a089b39208856f73e26d533d4912bb37050d.tar
gsoc2013-epiphany-70b9a089b39208856f73e26d533d4912bb37050d.tar.gz
gsoc2013-epiphany-70b9a089b39208856f73e26d533d4912bb37050d.tar.bz2
gsoc2013-epiphany-70b9a089b39208856f73e26d533d4912bb37050d.tar.lz
gsoc2013-epiphany-70b9a089b39208856f73e26d533d4912bb37050d.tar.xz
gsoc2013-epiphany-70b9a089b39208856f73e26d533d4912bb37050d.tar.zst
gsoc2013-epiphany-70b9a089b39208856f73e26d533d4912bb37050d.zip
ephy-string: improve a bit ephy_string_get_host_name
And add unit tests for it.
Diffstat (limited to 'lib')
-rw-r--r--lib/ephy-string.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/ephy-string.c b/lib/ephy-string.c
index 671ed55bf..48a054d8a 100644
--- a/lib/ephy-string.c
+++ b/lib/ephy-string.c
@@ -455,6 +455,15 @@ ephy_string_get_host_name (const char *url)
if (url == NULL || g_str_has_prefix (url, "file://")) return NULL;
uri = soup_uri_new (url);
+ /* If uri is NULL it's very possible that we just got
+ * something without a scheme, let's try to prepend
+ * 'http://' */
+ if (uri == NULL)
+ {
+ char *effective_url = g_strconcat ("http://", url, NULL);
+ uri = soup_uri_new (effective_url);
+ g_free (effective_url);
+ }
if (uri == NULL) return NULL;
ret = g_strdup (uri->host);