From 458101eb510c6805b169b889434fec498bdad834 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Mon, 18 Nov 2024 14:28:38 +0100 Subject: [PATCH 1/3] Editorial: adopt Infra number definitions (and redo IPv6 pieces) --- url.bs | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/url.bs b/url.bs index 44bfb8c..da7ad12 100644 --- a/url.bs +++ b/url.bs @@ -756,14 +756,14 @@ not equivalent and typically treated as distinct.

An IP address is an IPv4 address or an IPv6 address. -

An IPv4 address is a 32-bit unsigned integer that identifies a -network address. +

An IPv4 address is a 32-bit unsigned integer that +identifies a network address. [[RFC791]] -

An IPv6 address is a 128-bit unsigned integer that identifies a -network address. For the purposes of this standard it is represented as a list of eight -16-bit unsigned integers, also known as -IPv6 pieces. +

An IPv6 address is a 128-bit unsigned integer that +identifies a network address. For the purposes of this standard it is defined as of a +list of 8 16-bit unsigned integers, also known as its +pieces. [[RFC4291]]

Support for <zone_id> is @@ -1217,7 +1217,8 @@ these steps. They return failure or a tuple of a number and a boole actually doing that with the editors of this document first.

    -
  1. Let address be a new IPv6 address whose IPv6 pieces are all 0. +

  2. Let address be a new IPv6 address whose pieces + are all 0.

  3. Let pieceIndex be 0. @@ -1445,14 +1446,14 @@ actually doing that with the editors of this document first.

  4. Let output be the empty string.

  5. -

    Let compress be an index to the first IPv6 piece in the first longest - sequences of address's IPv6 pieces that are 0. +

    Let compress be an index to the first item in the first longest sequences of + address's pieces that are 0.

    In 0:f:0:0:f:f:0:0 it would point to the second 0. -

  6. If there is no sequence of address's IPv6 pieces that are 0 that is - longer than 1, then set compress to null. +

  7. If there is no sequence of address's pieces that are 0 + that is longer than 1, then set compress to null.

  8. Let ignore0 be false. @@ -1713,8 +1714,8 @@ It is initially the empty string. -

    A URL's port is either -null or a 16-bit unsigned integer that identifies a networking port. It is initially null. +

    A URL's port is either null or a +16-bit unsigned integer that identifies a networking port. It is initially null.

    A URL's path @@ -1974,8 +1975,8 @@ followed by a path-absolute-URL string.

    A scheme-relative-URL string must be @@ -2577,7 +2578,7 @@ and then runs these steps: by buffer in radix-10 using ASCII digits for digits with values 0 through 9. -

  9. If port is greater than 216 − 1, +

  10. If port is not a 16-bit unsigned integer, port-out-of-range validation error, return failure.

  11. Set url's port to null, if port is From a090dac65db3d84ec77a28337439be8ad70a038e Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Tue, 19 Nov 2024 11:36:34 +0100 Subject: [PATCH 2/3] bit more --- url.bs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/url.bs b/url.bs index da7ad12..11001b0 100644 --- a/url.bs +++ b/url.bs @@ -761,8 +761,8 @@ identifies a network address. [[RFC791]]

    An IPv6 address is a 128-bit unsigned integer that -identifies a network address. For the purposes of this standard it is defined as of a -list of 8 16-bit unsigned integers, also known as its +identifies a network address. This integer is composed of a list of 8 +16-bit unsigned integers, also known as an IPv6 address's pieces. [[RFC4291]] @@ -1445,16 +1445,16 @@ actually doing that with the editors of this document first.

    1. Let output be the empty string. +

    2. Let compress be null. +

    3. -

      Let compress be an index to the first item in the first longest sequences of +

      If multiple address's pieces are 0 sequentially, then set + compress to the index of the first item of the first of the longest sequences of address's pieces that are 0.

      In 0:f:0:0:f:f:0:0 it would point to the second 0. -

    4. If there is no sequence of address's pieces that are 0 - that is longer than 1, then set compress to null. -

    5. Let ignore0 be false.

    6. From 280ff43d71729b4b047427a05ff9b6cf1fae20b4 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Mon, 25 Nov 2024 17:42:59 +0100 Subject: [PATCH 3/3] quite a bit more --- url.bs | 69 ++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 57 insertions(+), 12 deletions(-) diff --git a/url.bs b/url.bs index 11001b0..2f475eb 100644 --- a/url.bs +++ b/url.bs @@ -1445,20 +1445,14 @@ actually doing that with the editors of this document first.
      1. Let output be the empty string. -

      2. Let compress be null. - -

      3. -

        If multiple address's pieces are 0 sequentially, then set - compress to the index of the first item of the first of the longest sequences of - address's pieces that are 0. - -

        In 0:f:0:0:f:f:0:0 it would point to - the second 0. +

      4. Let compress be the result of + finding the IPv6 address compressed piece index given address.

      5. Let ignore0 be false.

      6. -

        For each pieceIndex in the range 0 to 7, inclusive: +

        For each pieceIndex of address's + pieces's indices:

        1. If ignore0 is true and address[pieceIndex] is 0, then @@ -1470,8 +1464,8 @@ actually doing that with the editors of this document first.

          If compress is pieceIndex, then:

            -
          1. Let separator be "::" if pieceIndex is 0, and - U+003A (:) otherwise. +

          2. Let separator be "::" if pieceIndex is 0; otherwise + U+003A (:).

          3. Append separator to output. @@ -1492,6 +1486,57 @@ A Recommendation for IPv6 Address Text Representation. [[RFC5952]] +

            +

            To find the IPv6 address compressed piece index given an IPv6 address +address: + +

              +
            1. Let longestIndex be null. + +

            2. Let longestSize be 1. + +

            3. Let foundIndex be null. + +

            4. Let foundSize be 0. + +

            5. +

              For each pieceIndex of address's + pieces's indices: + +

                +
              1. +

                If address's pieces[pieceIndex] is not 0: + +

                  +
                1. If foundSize is greater than longestSize, then set + longestIndex to foundIndex and longestSize to + foundSize. + +

                2. Set foundIndex to null. + +
                3. Set foundSize to 0. +
                + +
              2. +

                Otherwise: + +

                  +
                1. If foundIndex is null, then set foundIndex to + pieceIndex. + +

                2. Increment foundSize by 1. +

                +
              + +
            6. If foundSize is greater than longestSize, then return + foundIndex. + +

            7. Return longestIndex. +

            + +

            In 0:f:0:0:f:f:0:0 it would point to the second 0. +

            +

            Host equivalence