simpleproxyresolver: Don't crash on invalid hostname

Check for g_hostname_to_ascii() failure, rather than crashing when
checking whether an invalid hostname should go through the proxy.

The HTTP library should report the error about the invalid hostname
once we actually try to connect to it.

https://bugzilla.gnome.org/show_bug.cgi?id=772989
This commit is contained in:
Bastien Nocera 2016-12-07 17:34:02 +01:00 committed by Philip Withnall
parent 1a99154898
commit cb8c919952

View File

@ -287,11 +287,13 @@ ignore_host (GSimpleProxyResolver *resolver,
if (priv->ignore_domains)
{
length = 0;
if (g_hostname_is_non_ascii (host))
host = ascii_host = g_hostname_to_ascii (host);
length = strlen (host);
if (host)
length = strlen (host);
for (i = 0; priv->ignore_domains[i].length; i++)
for (i = 0; length > 0 && priv->ignore_domains[i].length; i++)
{
GSimpleProxyResolverDomain *domain = &priv->ignore_domains[i];