Properly pass external addresses with libSoup 2.27.90

This commit is contained in:
Christian Dywan 2009-10-08 22:30:24 +02:00
parent fa8f109da9
commit 0ac4de8aa5
3 changed files with 14 additions and 4 deletions

View file

@ -1776,13 +1776,19 @@ main (int argc,
i = 0; i = 0;
while (uris[i] != NULL) while (uris[i] != NULL)
{ {
#if GLIB_CHECK_VERSION (2, 22, 0) #ifdef HAVE_LIBSOUP_2_27_90
gchar* encoded = g_hostname_to_unicode (uris[i]); gchar* path;
gchar* hostname = sokoke_hostname_from_uri (uris[i], &path);
gchar* encoded = g_hostname_to_ascii (hostname);
if (encoded) if (encoded)
{ {
gchar* res = g_strconcat ("http://", encoded, path, NULL);
g_free (uris[i]); g_free (uris[i]);
uris[i] = encoded; g_free (encoded);
uris[i] = res;
} }
g_free (hostname);
#else #else
uris[i] = sokoke_idn_to_punycode (uris[i]); uris[i] = sokoke_idn_to_punycode (uris[i]);
#endif #endif

View file

@ -197,7 +197,7 @@ sokoke_spawn_program (const gchar* command,
* *
* Return value: a newly allocated hostname * Return value: a newly allocated hostname
**/ **/
static gchar* gchar*
sokoke_hostname_from_uri (const gchar* uri, sokoke_hostname_from_uri (const gchar* uri,
gchar** path) gchar** path)
{ {

View file

@ -41,6 +41,10 @@ sokoke_spawn_program (const gchar* command,
gchar* sokoke_search_uri (const gchar* uri, gchar* sokoke_search_uri (const gchar* uri,
const gchar* keywords); const gchar* keywords);
gchar*
sokoke_hostname_from_uri (const gchar* uri,
gchar** path);
gchar* gchar*
sokoke_idn_to_punycode (gchar* uri); sokoke_idn_to_punycode (gchar* uri);