Hacker News new | ask | show | jobs
by deathanatos 3776 days ago
> ipv6 just happens to use a colon which conflicts with the port delimiter from authority in a URI

This is exactly what the article means by

> To fix the ambiguity, brackets were introduced

The addition of brackets disambiguates the grammar.

> the order for parsing for a URI is:

> // host = IP-literal / IPv4address / reg-name

No, that's a part of the grammar; it only means that a host is either an IP-literal, an IPv4address, or a reg-name; it does not imply any sort of ordering to those rules. Normally, the grammar should be unambiguous. Unfortunately here, the grammar for IPv4address and reg-name actually are ambiguous; I'll get to that.

> the only reason you would have conflicts with domain names is because they're de facto parsed after an IP

It's not defacto. It's in the same standard,

> The syntax rule for host is ambiguous because it does not completely distinguish between an IPv4address and a reg-name. In order to disambiguate the syntax, we apply the "first-match-wins" algorithm: If host matches the rule for IPv4address, then it should be considered an IPv4 address literal and not a reg-name.