Merge branch 'fix-g_inet_address_new_from_string' into 'main'

simpleproxyresolver: Ignore host with scope id

See merge request GNOME/glib!4202
This commit is contained in:
Philip Withnall 2024-10-08 13:48:32 +00:00
commit 7040162226

View File

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