From 0ac4de8aa561aac53a9f60e9792a0018bedc095e Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Thu, 8 Oct 2009 22:30:24 +0200 Subject: [PATCH] Properly pass external addresses with libSoup 2.27.90 --- midori/main.c | 12 +++++++++--- midori/sokoke.c | 2 +- midori/sokoke.h | 4 ++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/midori/main.c b/midori/main.c index 834e47d5..a8400f39 100644 --- a/midori/main.c +++ b/midori/main.c @@ -1776,13 +1776,19 @@ main (int argc, i = 0; while (uris[i] != NULL) { - #if GLIB_CHECK_VERSION (2, 22, 0) - gchar* encoded = g_hostname_to_unicode (uris[i]); + #ifdef HAVE_LIBSOUP_2_27_90 + gchar* path; + gchar* hostname = sokoke_hostname_from_uri (uris[i], &path); + gchar* encoded = g_hostname_to_ascii (hostname); + if (encoded) { + gchar* res = g_strconcat ("http://", encoded, path, NULL); g_free (uris[i]); - uris[i] = encoded; + g_free (encoded); + uris[i] = res; } + g_free (hostname); #else uris[i] = sokoke_idn_to_punycode (uris[i]); #endif diff --git a/midori/sokoke.c b/midori/sokoke.c index 2a9d966b..1b986ca2 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -197,7 +197,7 @@ sokoke_spawn_program (const gchar* command, * * Return value: a newly allocated hostname **/ -static gchar* +gchar* sokoke_hostname_from_uri (const gchar* uri, gchar** path) { diff --git a/midori/sokoke.h b/midori/sokoke.h index 15f2c882..854b0c33 100644 --- a/midori/sokoke.h +++ b/midori/sokoke.h @@ -41,6 +41,10 @@ sokoke_spawn_program (const gchar* command, gchar* sokoke_search_uri (const gchar* uri, const gchar* keywords); +gchar* +sokoke_hostname_from_uri (const gchar* uri, + gchar** path); + gchar* sokoke_idn_to_punycode (gchar* uri);