1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
3 /* GIO - GLib Input, Output and Streaming Library
5 * Copyright (C) 2008 Red Hat, Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General
18 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
26 #include "gnetworkaddress.h"
27 #include "gasyncresult.h"
28 #include "ginetaddress.h"
29 #include "ginetsocketaddress.h"
30 #include "gnetworkingprivate.h"
31 #include "gproxyaddressenumerator.h"
32 #include "gresolver.h"
34 #include "gsocketaddressenumerator.h"
36 #include "gsocketconnectable.h"
42 * SECTION:gnetworkaddress
43 * @short_description: A GSocketConnectable for resolving hostnames
46 * #GNetworkAddress provides an easy way to resolve a hostname and
47 * then attempt to connect to that host, handling the possibility of
48 * multiple IP addresses and multiple address families.
50 * See #GSocketConnectable for and example of using the connectable
57 * A #GSocketConnectable for resolving a hostname and connecting to
61 struct _GNetworkAddressPrivate {
67 gint64 resolver_serial;
77 static void g_network_address_set_property (GObject *object,
81 static void g_network_address_get_property (GObject *object,
86 static void g_network_address_connectable_iface_init (GSocketConnectableIface *iface);
87 static GSocketAddressEnumerator *g_network_address_connectable_enumerate (GSocketConnectable *connectable);
88 static GSocketAddressEnumerator *g_network_address_connectable_proxy_enumerate (GSocketConnectable *connectable);
90 G_DEFINE_TYPE_WITH_CODE (GNetworkAddress, g_network_address, G_TYPE_OBJECT,
91 G_ADD_PRIVATE (GNetworkAddress)
92 G_IMPLEMENT_INTERFACE (G_TYPE_SOCKET_CONNECTABLE,
93 g_network_address_connectable_iface_init))
96 g_network_address_finalize (GObject *object)
98 GNetworkAddress *addr = G_NETWORK_ADDRESS (object);
100 g_free (addr->priv->hostname);
101 g_free (addr->priv->scheme);
103 if (addr->priv->sockaddrs)
107 for (a = addr->priv->sockaddrs; a; a = a->next)
108 g_object_unref (a->data);
109 g_list_free (addr->priv->sockaddrs);
112 G_OBJECT_CLASS (g_network_address_parent_class)->finalize (object);
116 g_network_address_class_init (GNetworkAddressClass *klass)
118 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
120 gobject_class->set_property = g_network_address_set_property;
121 gobject_class->get_property = g_network_address_get_property;
122 gobject_class->finalize = g_network_address_finalize;
124 g_object_class_install_property (gobject_class, PROP_HOSTNAME,
125 g_param_spec_string ("hostname",
127 P_("Hostname to resolve"),
130 G_PARAM_CONSTRUCT_ONLY |
131 G_PARAM_STATIC_STRINGS));
132 g_object_class_install_property (gobject_class, PROP_PORT,
133 g_param_spec_uint ("port",
138 G_PARAM_CONSTRUCT_ONLY |
139 G_PARAM_STATIC_STRINGS));
141 g_object_class_install_property (gobject_class, PROP_SCHEME,
142 g_param_spec_string ("scheme",
147 G_PARAM_CONSTRUCT_ONLY |
148 G_PARAM_STATIC_STRINGS));
152 g_network_address_connectable_iface_init (GSocketConnectableIface *connectable_iface)
154 connectable_iface->enumerate = g_network_address_connectable_enumerate;
155 connectable_iface->proxy_enumerate = g_network_address_connectable_proxy_enumerate;
159 g_network_address_init (GNetworkAddress *addr)
161 addr->priv = g_network_address_get_instance_private (addr);
165 g_network_address_set_property (GObject *object,
170 GNetworkAddress *addr = G_NETWORK_ADDRESS (object);
175 g_free (addr->priv->hostname);
176 addr->priv->hostname = g_value_dup_string (value);
180 addr->priv->port = g_value_get_uint (value);
184 g_free (addr->priv->scheme);
185 addr->priv->scheme = g_value_dup_string (value);
189 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
196 g_network_address_get_property (GObject *object,
201 GNetworkAddress *addr = G_NETWORK_ADDRESS (object);
206 g_value_set_string (value, addr->priv->hostname);
210 g_value_set_uint (value, addr->priv->port);
214 g_value_set_string (value, addr->priv->scheme);
218 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
225 g_network_address_set_addresses (GNetworkAddress *addr,
227 guint64 resolver_serial)
230 GSocketAddress *sockaddr;
232 g_return_if_fail (addresses != NULL && addr->priv->sockaddrs == NULL);
234 for (a = addresses; a; a = a->next)
236 sockaddr = g_inet_socket_address_new (a->data, addr->priv->port);
237 addr->priv->sockaddrs = g_list_prepend (addr->priv->sockaddrs, sockaddr);
238 g_object_unref (a->data);
240 g_list_free (addresses);
241 addr->priv->sockaddrs = g_list_reverse (addr->priv->sockaddrs);
243 addr->priv->resolver_serial = resolver_serial;
247 g_network_address_parse_sockaddr (GNetworkAddress *addr)
249 GSocketAddress *sockaddr;
251 sockaddr = g_inet_socket_address_new_from_string (addr->priv->hostname,
255 addr->priv->sockaddrs = g_list_prepend (addr->priv->sockaddrs, sockaddr);
263 * g_network_address_new:
264 * @hostname: the hostname
267 * Creates a new #GSocketConnectable for connecting to the given
268 * @hostname and @port.
270 * Note that depending on the configuration of the machine, a
271 * @hostname of `localhost` may refer to the IPv4 loopback address
272 * only, or to both IPv4 and IPv6; use
273 * g_network_address_new_loopback() to create a #GNetworkAddress that
274 * is guaranteed to resolve to both addresses.
276 * Returns: (transfer full) (type GNetworkAddress): the new #GNetworkAddress
281 g_network_address_new (const gchar *hostname,
284 return g_object_new (G_TYPE_NETWORK_ADDRESS,
285 "hostname", hostname,
291 * g_network_address_new_loopback:
294 * Creates a new #GSocketConnectable for connecting to the local host
295 * over a loopback connection to the given @port. This is intended for
296 * use in connecting to local services which may be running on IPv4 or
299 * The connectable will return IPv4 and IPv6 loopback addresses,
300 * regardless of how the host resolves `localhost`. By contrast,
301 * g_network_address_new() will often only return an IPv4 address when
302 * resolving `localhost`, and an IPv6 address for `localhost6`.
304 * g_network_address_get_hostname() will always return `localhost` for
305 * #GNetworkAddresses created with this constructor.
307 * Returns: (transfer full) (type GNetworkAddress): the new #GNetworkAddress
312 g_network_address_new_loopback (guint16 port)
314 GNetworkAddress *addr;
317 addr = g_object_new (G_TYPE_NETWORK_ADDRESS,
318 "hostname", "localhost",
322 addrs = g_list_append (addrs, g_inet_address_new_loopback (AF_INET6));
323 addrs = g_list_append (addrs, g_inet_address_new_loopback (AF_INET));
324 g_network_address_set_addresses (addr, addrs, 0);
326 return G_SOCKET_CONNECTABLE (addr);
330 * g_network_address_parse:
331 * @host_and_port: the hostname and optionally a port
332 * @default_port: the default port if not in @host_and_port
333 * @error: a pointer to a #GError, or %NULL
335 * Creates a new #GSocketConnectable for connecting to the given
336 * @hostname and @port. May fail and return %NULL in case
337 * parsing @host_and_port fails.
339 * @host_and_port may be in any of a number of recognised formats; an IPv6
340 * address, an IPv4 address, or a domain name (in which case a DNS
341 * lookup is performed). Quoting with [] is supported for all address
342 * types. A port override may be specified in the usual way with a
345 * If no port is specified in @host_and_port then @default_port will be
346 * used as the port number to connect to.
348 * In general, @host_and_port is expected to be provided by the user
349 * (allowing them to give the hostname, and a port overide if necessary)
350 * and @default_port is expected to be provided by the application.
352 * (The port component of @host_and_port can also be specified as a
353 * service name rather than as a numeric port, but this functionality
354 * is deprecated, because it depends on the contents of /etc/services,
355 * which is generally quite sparse on platforms other than Linux.)
357 * Returns: (transfer full): the new #GNetworkAddress, or %NULL on error
362 g_network_address_parse (const gchar *host_and_port,
363 guint16 default_port,
366 GSocketConnectable *connectable;
371 g_return_val_if_fail (host_and_port != NULL, NULL);
374 if (host_and_port[0] == '[')
375 /* escaped host part (to allow, eg. "[2001:db8::1]:888") */
379 end = strchr (host_and_port, ']');
382 g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
383 _("Hostname '%s' contains '[' but not ']'"), host_and_port);
389 else if (end[1] == ':')
393 g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
394 "The ']' character (in hostname '%s') must come at the"
395 " end or be immediately followed by ':' and a port",
400 name = g_strndup (host_and_port + 1, end - host_and_port - 1);
403 else if ((port = strchr (host_and_port, ':')))
404 /* string has a ':' in it */
409 if (strchr (port, ':'))
410 /* more than one ':' in string */
412 /* this is actually an unescaped IPv6 address */
413 name = g_strdup (host_and_port);
417 name = g_strndup (host_and_port, port - host_and_port - 1);
421 /* plain hostname, no port */
422 name = g_strdup (host_and_port);
428 g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
429 "If a ':' character is given, it must be followed by a "
430 "port (in hostname '%s').", host_and_port);
435 else if ('0' <= port[0] && port[0] <= '9')
440 value = strtol (port, &end, 10);
441 if (*end != '\0' || value < 0 || value > G_MAXUINT16)
443 g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
444 "Invalid numeric port '%s' specified in hostname '%s'",
445 port, host_and_port);
455 struct servent *entry;
457 entry = getservbyname (port, "tcp");
460 g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
461 "Unknown service '%s' specified in hostname '%s'",
462 port, host_and_port);
463 #ifdef HAVE_ENDSERVENT
470 portnum = g_ntohs (entry->s_port);
472 #ifdef HAVE_ENDSERVENT
479 /* No port in host_and_port */
480 portnum = default_port;
483 connectable = g_network_address_new (name, portnum);
489 /* Allowed characters outside alphanumeric for unreserved. */
490 #define G_URI_OTHER_UNRESERVED "-._~"
492 /* This or something equivalent will eventually go into glib/guri.h */
494 _g_uri_parse_authority (const char *uri,
500 const char *start, *p, *at, *delim;
503 g_return_val_if_fail (uri != NULL, FALSE);
514 /* From RFC 3986 Decodes:
515 * URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
516 * hier-part = "//" authority path-abempty
517 * path-abempty = *( "/" segment )
518 * authority = [ userinfo "@" ] host [ ":" port ]
521 /* Check we have a valid scheme */
522 tmp_str = g_uri_parse_scheme (uri);
530 * hier-part = "//" authority path-abempty
533 start = strstr (p, "//");
540 /* check if the @ sign is part of the authority before attempting to
541 * decode the userinfo */
542 delim = strpbrk (start, "/?#[]");
543 at = strchr (start, '@');
544 if (at && delim && at > delim)
550 * userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
551 * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
552 * pct-encoded = "%" HEXDIG HEXDIG
565 if (!(g_ascii_isxdigit (p[0]) ||
566 g_ascii_isxdigit (p[1])))
574 /* unreserved / sub-delims / : */
575 if (!(g_ascii_isalnum (c) ||
576 strchr (G_URI_OTHER_UNRESERVED, c) ||
577 strchr (G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS, c) ||
583 *userinfo = g_strndup (start, p - start - 1);
594 * host = IP-literal / IPv4address / reg-name
595 * reg-name = *( unreserved / pct-encoded / sub-delims )
598 /* If IPv6 or IPvFuture */
601 gboolean has_scope_id = FALSE, has_bad_scope_id = FALSE;
612 if (c == '%' && !has_scope_id)
615 if (p[0] != '2' || p[1] != '5')
616 has_bad_scope_id = TRUE;
620 /* unreserved / sub-delims */
621 if (!(g_ascii_isalnum (c) ||
622 strchr (G_URI_OTHER_UNRESERVED, c) ||
623 strchr (G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS, c) ||
631 if (has_bad_scope_id)
632 *host = g_strndup (start, p - start - 1);
634 *host = g_uri_unescape_segment (start, p - 1, NULL);
655 if (!(g_ascii_isxdigit (p[0]) ||
656 g_ascii_isxdigit (p[1])))
664 /* unreserved / sub-delims */
665 if (!(g_ascii_isalnum (c) ||
666 strchr (G_URI_OTHER_UNRESERVED, c) ||
667 strchr (G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS, c)))
672 *host = g_uri_unescape_segment (start, p - 1, NULL);
692 if (!g_ascii_isdigit (c))
695 tmp = (tmp * 10) + (c - '0');
701 *port = (guint16) tmp;
713 if (userinfo && *userinfo)
723 _g_uri_from_authority (const gchar *protocol,
726 const gchar *userinfo)
730 uri = g_string_new (protocol);
731 g_string_append (uri, "://");
735 g_string_append_uri_escaped (uri, userinfo, G_URI_RESERVED_CHARS_ALLOWED_IN_USERINFO, FALSE);
736 g_string_append_c (uri, '@');
739 if (g_hostname_is_non_ascii (host))
741 gchar *ace_encoded = g_hostname_to_ascii (host);
745 g_string_free (uri, TRUE);
748 g_string_append (uri, ace_encoded);
749 g_free (ace_encoded);
751 else if (strchr (host, ':'))
752 g_string_append_printf (uri, "[%s]", host);
754 g_string_append (uri, host);
757 g_string_append_printf (uri, ":%u", port);
759 return g_string_free (uri, FALSE);
763 * g_network_address_parse_uri:
764 * @uri: the hostname and optionally a port
765 * @default_port: The default port if none is found in the URI
766 * @error: a pointer to a #GError, or %NULL
768 * Creates a new #GSocketConnectable for connecting to the given
769 * @uri. May fail and return %NULL in case parsing @uri fails.
771 * Using this rather than g_network_address_new() or
772 * g_network_address_parse() allows #GSocketClient to determine
773 * when to use application-specific proxy protocols.
775 * Returns: (transfer full): the new #GNetworkAddress, or %NULL on error
780 g_network_address_parse_uri (const gchar *uri,
781 guint16 default_port,
784 GSocketConnectable *conn;
789 if (!_g_uri_parse_authority (uri, &hostname, &port, NULL))
791 g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
800 scheme = g_uri_parse_scheme (uri);
802 conn = g_object_new (G_TYPE_NETWORK_ADDRESS,
803 "hostname", hostname,
815 * g_network_address_get_hostname:
816 * @addr: a #GNetworkAddress
818 * Gets @addr's hostname. This might be either UTF-8 or ASCII-encoded,
819 * depending on what @addr was created with.
821 * Returns: @addr's hostname
826 g_network_address_get_hostname (GNetworkAddress *addr)
828 g_return_val_if_fail (G_IS_NETWORK_ADDRESS (addr), NULL);
830 return addr->priv->hostname;
834 * g_network_address_get_port:
835 * @addr: a #GNetworkAddress
837 * Gets @addr's port number
839 * Returns: @addr's port (which may be 0)
844 g_network_address_get_port (GNetworkAddress *addr)
846 g_return_val_if_fail (G_IS_NETWORK_ADDRESS (addr), 0);
848 return addr->priv->port;
852 * g_network_address_get_scheme:
853 * @addr: a #GNetworkAddress
855 * Gets @addr's scheme
857 * Returns: @addr's scheme (%NULL if not built from URI)
862 g_network_address_get_scheme (GNetworkAddress *addr)
864 g_return_val_if_fail (G_IS_NETWORK_ADDRESS (addr), NULL);
866 return addr->priv->scheme;
869 #define G_TYPE_NETWORK_ADDRESS_ADDRESS_ENUMERATOR (_g_network_address_address_enumerator_get_type ())
870 #define G_NETWORK_ADDRESS_ADDRESS_ENUMERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_NETWORK_ADDRESS_ADDRESS_ENUMERATOR, GNetworkAddressAddressEnumerator))
873 GSocketAddressEnumerator parent_instance;
875 GNetworkAddress *addr;
878 } GNetworkAddressAddressEnumerator;
881 GSocketAddressEnumeratorClass parent_class;
883 } GNetworkAddressAddressEnumeratorClass;
885 static GType _g_network_address_address_enumerator_get_type (void);
886 G_DEFINE_TYPE (GNetworkAddressAddressEnumerator, _g_network_address_address_enumerator, G_TYPE_SOCKET_ADDRESS_ENUMERATOR)
889 g_network_address_address_enumerator_finalize (GObject *object)
891 GNetworkAddressAddressEnumerator *addr_enum =
892 G_NETWORK_ADDRESS_ADDRESS_ENUMERATOR (object);
894 g_object_unref (addr_enum->addr);
896 G_OBJECT_CLASS (_g_network_address_address_enumerator_parent_class)->finalize (object);
899 static GSocketAddress *
900 g_network_address_address_enumerator_next (GSocketAddressEnumerator *enumerator,
901 GCancellable *cancellable,
904 GNetworkAddressAddressEnumerator *addr_enum =
905 G_NETWORK_ADDRESS_ADDRESS_ENUMERATOR (enumerator);
906 GSocketAddress *sockaddr;
908 if (addr_enum->addresses == NULL)
910 GNetworkAddress *addr = addr_enum->addr;
911 GResolver *resolver = g_resolver_get_default ();
912 gint64 serial = g_resolver_get_serial (resolver);
914 if (addr->priv->resolver_serial != 0 &&
915 addr->priv->resolver_serial != serial)
917 /* Resolver has reloaded, discard cached addresses */
918 g_list_free_full (addr->priv->sockaddrs, g_object_unref);
919 addr->priv->sockaddrs = NULL;
922 if (!addr->priv->sockaddrs)
923 g_network_address_parse_sockaddr (addr);
924 if (!addr->priv->sockaddrs)
928 addresses = g_resolver_lookup_by_name (resolver,
929 addr->priv->hostname,
933 g_object_unref (resolver);
937 g_network_address_set_addresses (addr, addresses, serial);
940 addr_enum->addresses = addr->priv->sockaddrs;
941 addr_enum->next = addr_enum->addresses;
942 g_object_unref (resolver);
945 if (addr_enum->next == NULL)
948 sockaddr = addr_enum->next->data;
949 addr_enum->next = addr_enum->next->next;
950 return g_object_ref (sockaddr);
954 have_addresses (GNetworkAddressAddressEnumerator *addr_enum,
955 GTask *task, GError *error)
957 GSocketAddress *sockaddr;
959 addr_enum->addresses = addr_enum->addr->priv->sockaddrs;
960 addr_enum->next = addr_enum->addresses;
964 sockaddr = g_object_ref (addr_enum->next->data);
965 addr_enum->next = addr_enum->next->next;
971 g_task_return_error (task, error);
973 g_task_return_pointer (task, sockaddr, g_object_unref);
974 g_object_unref (task);
978 got_addresses (GObject *source_object,
979 GAsyncResult *result,
982 GTask *task = user_data;
983 GNetworkAddressAddressEnumerator *addr_enum = g_task_get_source_object (task);
984 GResolver *resolver = G_RESOLVER (source_object);
986 GError *error = NULL;
988 if (!addr_enum->addr->priv->sockaddrs)
990 addresses = g_resolver_lookup_by_name_finish (resolver, result, &error);
994 g_network_address_set_addresses (addr_enum->addr, addresses,
995 g_resolver_get_serial (resolver));
998 have_addresses (addr_enum, task, error);
1002 g_network_address_address_enumerator_next_async (GSocketAddressEnumerator *enumerator,
1003 GCancellable *cancellable,
1004 GAsyncReadyCallback callback,
1007 GNetworkAddressAddressEnumerator *addr_enum =
1008 G_NETWORK_ADDRESS_ADDRESS_ENUMERATOR (enumerator);
1009 GSocketAddress *sockaddr;
1012 task = g_task_new (addr_enum, cancellable, callback, user_data);
1014 if (addr_enum->addresses == NULL)
1016 GNetworkAddress *addr = addr_enum->addr;
1017 GResolver *resolver = g_resolver_get_default ();
1018 gint64 serial = g_resolver_get_serial (resolver);
1020 if (addr->priv->resolver_serial != 0 &&
1021 addr->priv->resolver_serial != serial)
1023 /* Resolver has reloaded, discard cached addresses */
1024 g_list_free_full (addr->priv->sockaddrs, g_object_unref);
1025 addr->priv->sockaddrs = NULL;
1028 if (!addr->priv->sockaddrs)
1030 if (g_network_address_parse_sockaddr (addr))
1031 have_addresses (addr_enum, task, NULL);
1034 g_resolver_lookup_by_name_async (resolver,
1035 addr->priv->hostname,
1037 got_addresses, task);
1039 g_object_unref (resolver);
1043 addr_enum->addresses = addr->priv->sockaddrs;
1044 addr_enum->next = addr_enum->addresses;
1045 g_object_unref (resolver);
1048 if (addr_enum->next)
1050 sockaddr = g_object_ref (addr_enum->next->data);
1051 addr_enum->next = addr_enum->next->next;
1056 g_task_return_pointer (task, sockaddr, g_object_unref);
1057 g_object_unref (task);
1060 static GSocketAddress *
1061 g_network_address_address_enumerator_next_finish (GSocketAddressEnumerator *enumerator,
1062 GAsyncResult *result,
1065 g_return_val_if_fail (g_task_is_valid (result, enumerator), NULL);
1067 return g_task_propagate_pointer (G_TASK (result), error);
1071 _g_network_address_address_enumerator_init (GNetworkAddressAddressEnumerator *enumerator)
1076 _g_network_address_address_enumerator_class_init (GNetworkAddressAddressEnumeratorClass *addrenum_class)
1078 GObjectClass *object_class = G_OBJECT_CLASS (addrenum_class);
1079 GSocketAddressEnumeratorClass *enumerator_class =
1080 G_SOCKET_ADDRESS_ENUMERATOR_CLASS (addrenum_class);
1082 enumerator_class->next = g_network_address_address_enumerator_next;
1083 enumerator_class->next_async = g_network_address_address_enumerator_next_async;
1084 enumerator_class->next_finish = g_network_address_address_enumerator_next_finish;
1085 object_class->finalize = g_network_address_address_enumerator_finalize;
1088 static GSocketAddressEnumerator *
1089 g_network_address_connectable_enumerate (GSocketConnectable *connectable)
1091 GNetworkAddressAddressEnumerator *addr_enum;
1093 addr_enum = g_object_new (G_TYPE_NETWORK_ADDRESS_ADDRESS_ENUMERATOR, NULL);
1094 addr_enum->addr = g_object_ref (connectable);
1096 return (GSocketAddressEnumerator *)addr_enum;
1099 static GSocketAddressEnumerator *
1100 g_network_address_connectable_proxy_enumerate (GSocketConnectable *connectable)
1102 GNetworkAddress *self = G_NETWORK_ADDRESS (connectable);
1103 GSocketAddressEnumerator *proxy_enum;
1106 uri = _g_uri_from_authority (self->priv->scheme ? self->priv->scheme : "none",
1107 self->priv->hostname,
1111 proxy_enum = g_object_new (G_TYPE_PROXY_ADDRESS_ENUMERATOR,
1112 "connectable", connectable,