soup-message-client-io: ASCIIfy unicode hostnames for Host header
authorDan Winship <danw@gnome.org>
Tue, 15 Feb 2011 20:13:32 +0000 (15:13 -0500)
committerDan Winship <danw@gnome.org>
Tue, 15 Feb 2011 20:13:32 +0000 (15:13 -0500)
We were resolving unicode hostnames correctly, but then putting them
in the Host header as UTF-8 rather than using the ASCII-encoded
version. Fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=642075

libsoup/soup-message-client-io.c

index 745d921..8796e90 100644 (file)
@@ -76,6 +76,8 @@ get_request_headers (SoupMessage *req, GString *header,
 
        if (strchr (uri->host, ':'))
                uri_host = g_strdup_printf ("[%s]", uri->host);
+       else if (g_hostname_is_non_ascii (uri->host))
+               uri_host = g_hostname_to_ascii (uri->host);
        else
                uri_host = uri->host;