After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 629259 - Failed to connect to "::1"
Failed to connect to "::1"
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: network
2.22.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-09-10 11:58 UTC by Guillaume Desmottes
Modified: 2010-09-10 17:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix IPv6 parsing in _g_uri_parse_authority, add _g_uri_from_authority (4.75 KB, patch)
2010-09-10 12:53 UTC, Dan Winship
needs-work Details | Review

Description Guillaume Desmottes 2010-09-10 11:58:21 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.
Comment 1 Dan Winship 2010-09-10 12:53:44 UTC
Created attachment 169947 [details] [review]
Fix IPv6 parsing in _g_uri_parse_authority, add _g_uri_from_authority

Fixes connections to IPv6 address literals.
Comment 2 Guillaume Desmottes 2010-09-10 13:45:02 UTC
Your patch fixes my issue, thanks a lot.
Comment 3 Nicolas Dufresne (ndufresne) 2010-09-10 14:18:26 UTC
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 :)
Comment 4 Dan Winship 2010-09-10 17:08:36 UTC
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