W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2015

Re: [whatwg] IPv4 parsing

From: Peter Kasting <pkasting@google.com>
Date: Wed, 24 Jun 2015 12:15:36 -0700
Message-ID: <CAAHOzFBeNP-92FT06G3acKX75JcAPh9=8tncj887Fa96hszGGA@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: timeless <timeless@gmail.com>, Alexey Proskuryakov <ap@webkit.org>, David Walp <David.Walp@microsoft.com>, WHATWG <whatwg@whatwg.org>, Mike West <mkwst@google.com>, Ryan Sleevi <sleevi@google.com>, Valentin Gosu <valentin.gosu@gmail.com>
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

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:33 UTC