Re: [whatwg] IPv4 parsing

On Wed, Jun 24, 2015 at 9:37 AM, Tab Atkins Jr. <jackalmage@gmail.com>
wrote:

> On Wed, Jun 24, 2015 at 9:23 AM, Anne van Kesteren <annevk@annevk.nl>
> wrote:
> > On Wed, Jun 24, 2015 at 9:06 AM, Tab Atkins Jr. <jackalmage@gmail.com>
> wrote:
> >> You swap between 0.0.0.66 and 66.0.0.0 in your OP.
> >
> > Actually, the input URL in that case is different. 0x42.0. != 0x42.
>
> Well *that's* confusing. ^_^  Def spec this in detail, please.


How Chrome's omnibox handles this (which I think is compliant with most
other places):

If there are no dots in the middle of the expression, the number is
converted to powers-of-256 format and leading 0s are prepended to reach
four octets:

66 = 0.0.0.66
256 = 0.0.1.0

If there are dots in the middle, the number after the last dot is treated
as above, while the numbers before the dots must satisfy 0 <= n <= 255 and
are placed into the highest octets in order:

1.66 = 1.0.0.66
1.256 = 1.0.1.0
1.2.66 = 1.2.0.66
1.256.66 = invalid

PK

Received on Wednesday, 24 June 2015 19:16:09 UTC