summary refs log tree commit diff stats
path: root/src/fe-gtk
diff options
context:
space:
mode:
Diffstat (limited to 'src/fe-gtk')
-rw-r--r--src/fe-gtk/fe-gtk.c20
-rw-r--r--src/fe-gtk/maingui.c2
2 files changed, 19 insertions, 3 deletions
diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c
index 28a3b1d5..6890286f 100644
--- a/src/fe-gtk/fe-gtk.c
+++ b/src/fe-gtk/fe-gtk.c
@@ -1008,11 +1008,13 @@ fe_open_url_inner (const char *url)
 static void
 fe_open_url_locale (const char *url)
 {
-	if (url_check_word (url) == WORD_PATH)
+	int url_type = url_check_word (url);
+	char *uri;
+
+	/* gvfs likes file:// */
+	if (url_type == WORD_PATH)
 	{
 #ifndef WIN32
-		char *uri;
-		
 		uri = g_strconcat ("file://", url, NULL);
 		fe_open_url_inner (uri);
 		g_free (uri);
@@ -1020,6 +1022,18 @@ fe_open_url_locale (const char *url)
 		fe_open_url_inner (url);
 #endif
 	}
+	/* IPv6 addr. Add http:// */
+	else if (url_type == WORD_HOST6)
+	{
+		/* IPv6 addrs in urls should be enclosed in [ ] */
+		if (*url != '[')
+			uri = g_strdup_printf ("http://[%s]", url);
+		else
+			uri = g_strdup_printf ("http://%s", url);
+
+		fe_open_url_inner (uri);
+		g_free (uri);
+	}
 	/* the http:// part's missing, prepend it, otherwise it won't always work */
 	else if (strchr (url, ':') == NULL)
 	{
diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c
index 100642e1..2a486b17 100644
--- a/src/fe-gtk/maingui.c
+++ b/src/fe-gtk/maingui.c
@@ -2267,6 +2267,7 @@ mg_word_clicked (GtkWidget *xtext, char *word, GdkEventButton *even)
 			switch (word_type)
 			{
 			case WORD_URL:
+			case WORD_HOST6:
 			case WORD_HOST:
 				word[end] = 0;
 				fe_open_url (word + start);
@@ -2293,6 +2294,7 @@ mg_word_clicked (GtkWidget *xtext, char *word, GdkEventButton *even)
 		menu_middlemenu (sess, even);
 		break;
 	case WORD_URL:
+	case WORD_HOST6:
 	case WORD_HOST:
 		word[end] = 0;
 		word += start;