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 700455 - gio: Handle IPv6 zone ids in _g_uri_parse_authority
gio: Handle IPv6 zone ids in _g_uri_parse_authority
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: network
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2013-05-16 12:44 UTC by Christophe Fergeau
Modified: 2013-08-20 15:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gio: Handle IPv6 zone ids in _g_uri_parse_authority (1.20 KB, patch)
2013-05-16 12:44 UTC, Christophe Fergeau
reviewed Details | Review

Description Christophe Fergeau 2013-05-16 12:44:30 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).
Comment 1 Christophe Fergeau 2013-05-16 12:44:32 UTC
Created attachment 244400 [details] [review]
gio: Handle IPv6 zone ids in _g_uri_parse_authority
Comment 2 Dan Winship 2013-05-25 13:40:57 UTC
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.
Comment 3 Christophe Fergeau 2013-05-27 11:24:56 UTC
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 ;)
Comment 4 Dan Winship 2013-05-29 16:58:03 UTC
(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.
Comment 5 Dan Winship 2013-08-20 15:28:17 UTC
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'.