GNOME Bugzilla – Bug 700455
gio: Handle IPv6 zone ids in _g_uri_parse_authority
Last modified: 2013-08-20 15:28:17 UTC
_g_uri_parse_authority roughly follows RFC3986 when parsing URIs, but it does not take into account IPv6 zone ids which were added in RFC 6874. This commit does not do all the validation described in that RFC with respect to what comes after the '%' char (ie that it's either %25, or that the 2 chars after % cannot be interpreted as an hex value).
Created attachment 244400 [details] [review] gio: Handle IPv6 zone ids in _g_uri_parse_authority
Comment on attachment 244400 [details] [review] gio: Handle IPv6 zone ids in _g_uri_parse_authority that is an ugly function... anyway, good to commit if you add a test to test_parse_uri() in gio/tests/network-address.c Actually, add a test to test_parse() too; it ought to work without any additional code changes, but it would be good to make sure.
Thanks for asking for a test case as the code is actually broken ;) Adding an unescaped % in the URI causes issues with the call to if (host) *host = g_uri_unescape_segment (start, p - 1, NULL); Also, one question that came to mind is if zoneids should be part of the hostname returned by g_network_address_get_hostname()? I'd say yes, but I prefer to check first ;)
(In reply to comment #3) > Also, one question that came to mind is if zoneids should be part of the > hostname returned by g_network_address_get_hostname()? I'd say yes, but I > prefer to check first ;) Grepping through a jhbuild checkout suggests that including it would work better than not including it in most contexts, but it also means that if you connect to "https://myserver%eth0/", then glib-networking would expect the server to present a TLS certificate for "myserver%eth0", which is definitely wrong... Still, I think the best solution might be to just adjust glib-networking (and anything else that breaks) to deal with that change.
oh, this is fixed in glib master / 2.37.6. I forgot about this bug and then didn't notice it this weekend because it was under 'gio' instead of 'network'.