simpleproxyresolver: Ignore host with scope id

Ignore host successfully when a ipv6 address contains a scope id.
This commit is contained in:
Gustav Johansson 2024-08-21 10:33:38 +02:00 committed by Philip Withnall
parent 4416d9dcce
commit a4a516a8ab

View File

@ -26,6 +26,7 @@
#include "gsimpleproxyresolver.h"
#include "ginetaddress.h"
#include "ginetsocketaddress.h"
#include "ginetaddressmask.h"
#include "gnetworkingprivate.h"
#include "gtask.h"
@ -264,9 +265,13 @@ ignore_host (GSimpleProxyResolver *resolver,
if (priv->ignore_ips)
{
GInetAddress *iaddr;
GInetSocketAddress *isaddr = NULL;
iaddr = g_inet_address_new_from_string (host);
if (iaddr)
/* Grab the GInetAddress from the GInetSocketAddress in order to support
* scope ID. */
isaddr = (GInetSocketAddress *) g_inet_socket_address_new_from_string (host, 0);
iaddr = (isaddr != NULL) ? g_inet_socket_address_get_address (isaddr) : NULL;
if (iaddr != NULL)
{
for (i = 0; i < priv->ignore_ips->len; i++)
{
@ -278,11 +283,12 @@ ignore_host (GSimpleProxyResolver *resolver,
break;
}
}
g_object_unref (iaddr);
if (ignore)
return TRUE;
}
g_clear_object (&isaddr);
if (ignore)
return TRUE;
}
if (priv->ignore_domains)