summary refs log tree commit diff stats
path: root/src/fe-gtk
diff options
context:
space:
mode:
authorDiogo Sousa <diogogsousa@gmail.com>2013-06-19 00:15:47 +0100
committerDiogo Sousa <diogogsousa@gmail.com>2013-06-19 00:15:47 +0100
commit02139fbb79e8a761ade80a6fffc03f072d97b3da (patch)
treeae768b085aef88c5d6882481ec4b140229e3484e /src/fe-gtk
parent9ef1d1db96f8f5b0606bb1990cace7feb7335580 (diff)
Handle IPv6 addresses correcly in fe_open_url_locale().
Diffstat (limited to 'src/fe-gtk')
-rw-r--r--src/fe-gtk/fe-gtk.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c
index e017b9b9..e3b4ec80 100644
--- a/src/fe-gtk/fe-gtk.c
+++ b/src/fe-gtk/fe-gtk.c
@@ -1008,8 +1008,22 @@ fe_open_url_inner (const char *url)
 static void
 fe_open_url_locale (const char *url)
 {
+	int url_type = url_check_word (url);
+
+	/* IPv6 addr. Add http:// */
+	if (url_type == WORD_HOST6)
+	{
+		/* IPv6 addrs in urls should be enclosed in [ ] */
+		if (*url != '[')
+			url = g_strdup_printf ("http://[%s]", url);
+		else
+			url = g_strdup_printf ("http://%s", url);
+
+		fe_open_url_inner (url);
+		g_free ((char *)url);
+	}
 	/* the http:// part's missing, prepend it, otherwise it won't always work */
-	if (strchr (url, ':') == NULL && url_check_word (url) != WORD_PATH)
+	else if (strchr (url, ':') == NULL && url_type != WORD_PATH)
 	{
 		url = g_strdup_printf ("http://%s", url);
 		fe_open_url_inner (url);