/pidgin/main: c76b490587d4: Improve URI handling on Windows 8.

Daniel Atallah datallah at pidgin.im
Sat Jan 19 14:46:29 EST 2013


Changeset: c76b490587d429f2fe830c412f2f685bf411a656
Author:	 Daniel Atallah <datallah at pidgin.im>
Date:	 2013-01-19 14:41 -0500
Branch:	 release-2.x.y
URL: http://hg.pidgin.im/pidgin/main/rev/c76b490587d4

Description:

Improve URI handling on Windows 8.

 * This isn't ideal - we now pass https, ftp and mailto URIs to their specific
   handlers and everything else still goes to the http handler.
 * Fixes #15273

diffstat:

 pidgin/win32/gtkwin32dep.c |  15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diffs (26 lines):

diff --git a/pidgin/win32/gtkwin32dep.c b/pidgin/win32/gtkwin32dep.c
--- a/pidgin/win32/gtkwin32dep.c
+++ b/pidgin/win32/gtkwin32dep.c
@@ -171,10 +171,19 @@ void winpidgin_shell_execute(const char 
 }
 
 void winpidgin_notify_uri(const char *uri) {
-	/* We'll allow whatever URI schemes are supported by the
-	 * default http browser.
+	/* Allow a few commonly used and "safe" schemes to go to the specific
+	 * class handlers and send everything else to the default http browser.
+	 * This isn't optimal, but should cover the most common cases. I didn't
+	 * see any better secure solutions when I did some research.
 	 */
-	winpidgin_shell_execute(uri, "open", "http");
+	gchar *scheme = g_uri_parse_scheme(uri);
+	if (scheme && (g_ascii_strcasecmp(scheme, "https") == 0
+			|| g_ascii_strcasecmp(scheme, "ftp") == 0
+			|| g_ascii_strcasecmp(scheme, "mailto") == 0))
+		winpidgin_shell_execute(uri, "open", scheme);
+	else
+		winpidgin_shell_execute(uri, "open", "http");
+	g_free(scheme);
 }
 
 #define PIDGIN_WM_FOCUS_REQUEST (WM_APP + 13)



More information about the Commits mailing list