GNOME Bugzilla – Bug 629259
Failed to connect to "::1"
Last modified: 2010-09-10 17:08:42 UTC
Calling g_socket_client_connect_async on an IPv6 address created using g_inet_address_new_from_string("::1") raises this error with master: GLib-GIO-WARNING **: Invalid URI 'none://::1:52917' This used to work fine using glib 2.25.13.
Created attachment 169947 [details] [review] Fix IPv6 parsing in _g_uri_parse_authority, add _g_uri_from_authority Fixes connections to IPv6 address literals.
Your patch fixes my issue, thanks a lot.
Review of attachment 169947 [details] [review]: Have a close look at the two comments I made, when fixed, ++ for this change. ::: gio/gnetworkaddress.c @@ -529,3 +529,3 @@ while (1) { - c = *p++; + c = *++p; This make sense, but could you check if you haven't broke the host string at line 579? I think the result will be "[::1" instead of "[::1]". Two possible fix, keep the code as-is, and ass p++; before the while, or do p++ before the final break (c == ']'. @@ +639,3 @@ + if (userinfo) + { + g_string_append_uri_escaped (uri, userinfo, NULL, FALSE); Here you should pass G_URI_RESERVED_CHARS_ALLOWED_IN_USERINFO instead of NULL, otherwise you will encode things you don't want (like the :)
actually, it looks like parse_network_uri was already broken with IPv6 addrs. fixed it and tested that it works now Attachment 169947 [details] pushed as 59383c8 - Fix IPv6 parsing in _g_uri_parse_authority, add _g_uri_from_authority