Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editorial: adopt Infra number definitions (and redo IPv6 pieces) #838

Merged
merged 3 commits into from
Nov 26, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions url.bs
Original file line number Diff line number Diff line change
Expand Up @@ -756,14 +756,14 @@ not equivalent and typically treated as distinct.

<p>An <dfn export>IP address</dfn> is an <a>IPv4 address</a> or an <a>IPv6 address</a>.

<p>An <dfn export id=concept-ipv4>IPv4 address</dfn> is a 32-bit unsigned integer that identifies a
network address.
<p>An <dfn export id=concept-ipv4>IPv4 address</dfn> is a <a for=/>32-bit unsigned integer</a> that
identifies a network address.
[[RFC791]]

<p>An <dfn export id=concept-ipv6>IPv6 address</dfn> is a 128-bit unsigned integer that identifies a
network address. For the purposes of this standard it is represented as a <a for=/>list</a> of eight
16-bit unsigned integers, also known as
<dfn export lt="IPv6 piece" id=concept-ipv6-piece>IPv6 pieces</dfn>.
<p>An <dfn export id=concept-ipv6>IPv6 address</dfn> is a <a for=/>128-bit unsigned integer</a> that
identifies a network address. This integer is composed of a <a for=/>list</a> of 8
<a for=/>16-bit unsigned integers</a>, also known as an <a for=/>IPv6 address</a>'s
<dfn export for="IPv6 address" id=concept-ipv6-piece>pieces</dfn>.
Comment on lines +763 to +766
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This definition is obscure: it is not clear how to convert a 128-bit integer to a list of pieces and vice versa. Also, all algorithms use an IPv6 address as a list of pieces, not as a 128-bit integer. By the way, RFC4291 defines an IPv6 address slightly differently: "IPv6 addresses are 128-bit identifiers...". So I think it is better to use the RFC4291 definition - replace "unsigned integer" with "identifier":

An IPv6 address is a 128-bit identifier that identifies a network address. This identifier is composed of ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All algorithms inside URL, yes, but outside? This we would have to change separately though as changing it from integer to identifier would not be an editorial change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do agree that this is a bit confusing. I can see how it's "conceptually" a u128, or "corresponds to" a u128, but in practice every part of the spec treats it as a list of 8 u16s.

[[RFC4291]]

<p class="note">Support for <code>&lt;zone_id></code> is
Expand Down Expand Up @@ -1217,7 +1217,8 @@ these steps. They return failure or a <a for=/>tuple</a> of a number and a boole
actually doing that with the editors of this document first.

<ol>
<li><p>Let <var>address</var> be a new <a>IPv6 address</a> whose <a>IPv6 pieces</a> are all 0.
<li><p>Let <var>address</var> be a new <a>IPv6 address</a> whose <a for="IPv6 address">pieces</a>
are all 0.

<li><p>Let <var>pieceIndex</var> be 0.

Expand Down Expand Up @@ -1444,16 +1445,16 @@ actually doing that with the editors of this document first.
<ol>
<li><p>Let <var>output</var> be the empty string.

<li><p>Let <var>compress</var> be null.

<li>
<p>Let <var>compress</var> be an index to the first <a>IPv6 piece</a> in the first longest
sequences of <var>address</var>'s <a>IPv6 pieces</a> that are 0.
<p>If multiple <var>address</var>'s <a for="IPv6 address">pieces</a> are 0 sequentially, then set
<var>compress</var> to the index of the first item of the first of the longest sequences of
<var>address</var>'s <a for="IPv6 address">pieces</a> that are 0.

<p class=example id=example-e2b3492e>In <code>0:f:0:0:f:f:0:0</code> it would point to
the second 0.

<li><p>If there is no sequence of <var>address</var>'s <a>IPv6 pieces</a> that are 0 that is
longer than 1, then set <var>compress</var> to null.

<li><p>Let <var>ignore0</var> be false.
annevk marked this conversation as resolved.
Show resolved Hide resolved

<li>
Expand Down Expand Up @@ -1713,8 +1714,8 @@ It is initially the empty string.
</table>
</div>

<p>A <a for=/>URL</a>'s <dfn export for=url id=concept-url-port>port</dfn> is either
null or a 16-bit unsigned integer that identifies a networking port. It is initially null.
<p>A <a for=/>URL</a>'s <dfn export for=url id=concept-url-port>port</dfn> is either null or a
<a for=/>16-bit unsigned integer</a> that identifies a networking port. It is initially null.

<p>A <a for=/>URL</a>'s
<dfn export for=url id=concept-url-path oldids=non-relative-flag,url-cannot-be-a-base-url-flag>path</dfn>
Expand Down Expand Up @@ -1974,8 +1975,8 @@ followed by a <a>path-absolute-URL string</a>.

<ul class=brief>
<li><p>the empty string
<li><p>one or more <a>ASCII digits</a> representing a decimal number no greater than
2<sup>16</sup>&nbsp;&minus;&nbsp;1.
<li><p>one or more <a>ASCII digits</a> representing a decimal number that is a
<a for=/>16-bit unsigned integer</a>.
</ul>

<p>A <dfn export oldids=syntax-url-scheme-relative>scheme-relative-URL string</dfn> must be
Expand Down Expand Up @@ -2577,7 +2578,7 @@ and then runs these steps:
by <var>buffer</var> in radix-10 using <a>ASCII digits</a> for digits with values
0 through 9.

<li><p>If <var>port</var> is greater than 2<sup>16</sup>&nbsp;&minus;&nbsp;1,
<li><p>If <var>port</var> is not a <a for=/>16-bit unsigned integer</a>,
<a>port-out-of-range</a> <a>validation error</a>, return failure.

<li><p>Set <var>url</var>'s <a for=url>port</a> to null, if <var>port</var> is
Expand Down