Skip to content

Commit

Permalink
put errors in order of appearance (mostly)
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Jan 20, 2023
1 parent 4b46875 commit 7954d0a
Showing 1 changed file with 184 additions and 152 deletions.
336 changes: 184 additions & 152 deletions url.bs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,179 @@ valid input. User agents, especially conformance checkers, are encouraged to rep
<th>Error description
<th>Failure
<tbody>
<tr>
<th colspan=3 scope=rowgroup><a href=#idna>IDNA</a>
<tr>
<td><dfn id=validation-error-domain-to-ascii>domain-to-ASCII</dfn>
<td>
<p>The result of <a abstract-op lt=ToASCII>Unicode toASCII</a> records an error while processing
the input domain.
<p class=note>[[!UTS46]] conformance does not require the reporting of precise errors, only that
an error has occurred. If the [[!UTS46]] implementation reports precise error codes, user agents
are encouraged pass those codes along.
<td>
<tr>
<td><dfn>domain-to-ASCII-empty</dfn>
<td>
<p>The result of <a abstract-op lt=ToASCII>Unicode toASCII</a> returns an empty string. This
could have been caused by:
<ul>
<li>Input consists of all ignorable code points.
<li>Input is the string "<code>xn--</code>".
<li>Input is the empty string and the <i>VerifyDnsLength</i> parameter is false.
</ul>
<td>
<tr>
<td><dfn>domain-to-Unicode</dfn>
<td>
<p>The result of <a abstract-op lt=ToUnicode>Unicode toUnicode</a> returns an error while
processing the input domain.
<p class=note>The same considerations as with <a>domain-to-ASCII</a> apply.
<td>
<tbody>
<tr>
<th colspan=3 scope=rowgroup><a href=#host-parsing>Host parsing</a>
<!-- host parser -->
<tr>
<td><dfn>unclosed-IPv6-address</dfn>
<td>
<p>An IPv6 address is missing the closing U+005D (]).
<p class=example id=example-unclosed-ipv6-address>"<code>https://[::1</code>"
<td>
<tr>
<td><dfn id=validation-error-forbidden-domain-code-point>forbidden-domain-code-point</dfn>
<td>
<p>The input's host contains a <a>forbidden domain code point</a>.
<div class=example id=example-forbidden-domain-code-point>
<p>Hosts are <a for=string>percent-decoded</a> before being processed when the URL
<a>is special</a>, which would result in the following host portion becoming
"<code>exa#mple.org</code>".
<p>"<code>https://exa%23mple.org</code>"
</div>
<td>
<!-- IPv4 parser -->
<tr>
<td><dfn>empty-IPv4-part</dfn>
<td>
<p>Input to the <a>IPv4 parser</a> ends with a U+002E.
<p class=example id=example-empty-ipv4-part>"<code>https://127.0.0.1./</code>"
<td>
<tr>
<td><dfn>too-many-IPv4-parts</dfn>
<td>
<p>An <a for=/>IPv4 address</a> consists of 4 parts.
<p class=example id=example-too-many-ipv4-parts>"<code>https://1.2.3.4.5/</code>"
<td>
<tr>
<td><dfn>non-numeric-IPv4-part</dfn>
<td>
<p>An IPv4 part was not numeric.
<p class=example id=example-non-numeric-ipv4-part>"<code>https://test.42</code>"
<td>
<tr>
<td><dfn>non-decimal-IPv4-part</dfn>
<td>
<p>The IPv4 address contains numbers expressed using hexadecimal or octal digits.
<p class=example id=example-non-decimal-ipv4-part>"<code>https://127.0.0x0.1</code>"
<td>
<tr>
<td><dfn>IPv4-part-out-of-range</dfn>
<td>
<p>An IPv4 part exceeds 255.
<p class=example id=example-ipv4-part-out-of-range>"<code>https://255.255.4000.1</code>"
<td>✅ (only if applicable to the last IPv4 part)
<!-- IPv6 parser -->
<tr>
<td><dfn>invalid-compressed-IPv6-address</dfn>
<td>
<p>An IPv6 address begins with improper compression.
<p class=example id=example-invalid-compressed-ipv6-address>"<code>https://[:1]</code>"
<td>
<tr>
<td><dfn>IPv6-too-many-pieces</dfn>
<td>
<p>An IPv6 address contains more than 8 pieces.
<p class=example id=example-ipv6-too-many-pieces>"<code>https://[1:2:3:4:5:6:7:8:9]</code>"
<td>
<tr>
<td><dfn>IPv6-multiple-compression</dfn>
<td>
<p>An IPv6 address is compressed in more than one spot.
<p class=example id=example-ipv6-multiple-compression>"<code>https://[1::1::1]</code>"
<td>
<tr>
<td><dfn>IPv4-in-IPv6-empty-part</dfn>
<td>
<p>An IPv6 address that contains an IPv4 address has an empty part in the IPv4 address.
<p class=example id=example-ipv4-in-ipv6-empty-part>"<code>https://[ffff::.0.0.1]</code>"
<td>
<tr>
<td><dfn>IPv4-in-IPv6-too-many-pieces</dfn>
<td>
<p>An IPv6 address contains an IPv4 address and the IPv6 address has more than 6 pieces.
<p class=example id=example-ipv4-in-ipv6-too-many-pieces>"<code>https://[1:1:1:1:1:1:1:127.0.0.1]</code>"
<td>
<tr>
<td><dfn>IPv4-in-IPv6-too-many-parts</dfn>
<td>
<p>An IPv6 address contains an IPv4 address and the IPv4 address has more than 4 parts.
<p class=example id=example-ipv4-in-ipv6-too-many-parts>"<code>https://[ffff::127.0.0.1.2]</code>"
<td>
<tr>
<td><dfn>IPv4-in-IPv6-unexpected-code-point</dfn>
<td>
<p>An IPv6 address contains an IPv4 address of which a part contain a code point other than an
<a>ASCII digits</a> or is the empty string.
<p class=example id=example-ipv4-in-ipv6-unexpected-code-point>"<code>https://[ffff::127.0.xyz.1]</code>"
<td>
<tr>
<td><dfn>IPv4-in-IPv6-invalid-first-part</dfn>
<td>
<p>The first part of an IPv4 address that is contained within an IPv6 address is 0.
<p class=example id=example-ipv4-in-ipv6-invalid-first-part>"<code>https://[ffff::0.0.0.1]</code>"
<td>
<tr>
<td><dfn>IPv4-in-IPv6-part-out-of-range</dfn>
<td>
<p>An IPv4 address contained within an IPv6 address contains a part that exceeds 255.
<p class=example id=example-ipv4-in-ipv6-part-out-of-range>"<code>https://[ffff::127.0.0.4000]</code>"
<td>
<tr>
<td><dfn>IPv4-in-IPv6-too-few-parts</dfn>
<td>
<p>An IPv4 address contained within an IPv6 address does not contain exactly 4 parts.
<p class=example id=example-ipv4-in-ipv6-too-few-parts>"<code>https://[ffff::127.0.0]</code>"
<td>
<tr>
<td><dfn>IPv6-unexpected-EOF</dfn>
<td>
<p>An IPv6 address unexpectedly ends.
<p class=example id=example-ipv6-unexpected-eof>"<code>https://[1:2:3:]</code>"
<td>
<tr>
<td><dfn>IPv6-unexpected-delimiter</dfn>
<td>
<p>An IPv6 address contains a code point that is neither an <a>ASCII hex digit</a> nor a
U+003A (:).
<p class=example id=example-ipv6-unexpected-delimiter>"<code>https://[1:2:3!:4]</code>"
<td>
<tr>
<td><dfn>IPv6-too-few-pieces</dfn>
<td>
<p>An uncompressed IPv6 address contains fewer than 8 pieces.
<p class=example id=example-ipv6-too-few-pieces>"<code>https://[1:2:3]</code>"
<td>
<!-- opaque-host parser -->
<tr>
<td><dfn id=validation-error-forbidden-host-code-point>forbidden-host-code-point</dfn>
<td>
<p>When an <a>opaque host</a> (in a URL that <a>is not special</a>) contains a
<a>forbidden host code point</a>.
<p class=example id=example-forbidden-host-code-point>"<code>foo://exa[mple.org</code>"
<td>
<tbody>
<tr>
<th colspan=3 scope=rowgroup><a href=#url-parsing>URL parsing</a>
<tr>
<td><dfn>unexpected-C0-control-or-space</dfn>
<td>
Expand Down Expand Up @@ -224,6 +397,9 @@ let url = new URL("/c:/path/to/file", "file:///c:/");</code></pre>
<p>The file URL's host is a Windows drive letter.
<p class=example id=example-unexpected-windows-drive-letter-host>"<code>file://c:</code>"
<td>
<tbody>
<tr>
<th colspan=3 scope=rowgroup>URL parsing and <a>opaque-host parser</a>
<tr>
<td><dfn>invalid-URL-code-point</dfn>
<td>
Expand All @@ -238,149 +414,6 @@ let url = new URL("/c:/path/to/file", "file:///c:/");</code></pre>
<a for=url>path</a>, <a for=url>query</a>, or <a for=url>fragment</a>.
<p class=example id=example-unescaped-percent-sign>"<code>https://example.org/%s</code>"
<td>
<tr>
<td><dfn>unclosed-IPv6-address</dfn>
<td>
<p>An IPv6 address is missing the closing U+005D (]).
<p class=example id=example-unclosed-ipv6-address>"<code>https://[::1</code>"
<td>
<tr>
<td><dfn id=validation-error-domain-to-ascii>domain-to-ASCII</dfn>
<td>
<p>The result of <a abstract-op lt=ToASCII>Unicode toASCII</a> records an error while processing
the input domain.
<p class=note>[[!UTS46]] conformance does not require the reporting of precise errors, only that
an error has occurred. If the [[!UTS46]] implementation reports precise error codes, user agents
are encouraged pass those codes along.
<td>
<tr>
<td><dfn>domain-to-ASCII-empty</dfn>
<td>
<p>The result of <a abstract-op lt=ToASCII>Unicode toASCII</a> returns an empty string. This
could have been caused by:
<ul>
<li>Input consists of all ignorable code points.
<li>Input is the string "<code>xn--</code>".
<li>Input is the empty string and the <i>VerifyDnsLength</i> parameter is false.
</ul>
<td>
<tr>
<td><dfn>domain-to-Unicode</dfn>
<td>
<p>The result of <a abstract-op lt=ToUnicode>Unicode toUnicode</a> returns an error while
processing the input domain.
<p class=note>The same considerations as with <a>domain-to-ASCII</a> apply.
<td>
<tr>
<td><dfn id=validation-error-forbidden-domain-code-point>forbidden-domain-code-point</dfn>
<td>
<p>The input's host contains a <a>forbidden domain code point</a>.
<div class=example id=example-forbidden-domain-code-point>
<p>Hosts are <a for=string>percent-decoded</a> before being processed when the URL
<a>is special</a>, which would result in the following host portion becoming
"<code>exa#mple.org</code>".
<p>"<code>https://exa%23mple.org</code>"
</div>
<td>
<tr>
<td><dfn>unexpected-non-decimal-number</dfn>
<td>
<p>The IPv4 address contains numbers expressed using hexadecimal or octal digits.
<p class=example id=example-unexpected-non-decimal-number>"<code>https://127.0.0x0.1</code>"
<td>
<tr>
<td><dfn>IPv4-part-out-of-range</dfn>
<td>
<p>An IPv4 part exceeds 255. This is only fatal if the last part exceeds 255.
<p class=example id=example-ipv4-part-out-of-range>"<code>https://255.255.4000.1</code>"
<td>
<tr>
<td><dfn>invalid-compressed-IPv6-address</dfn>
<td>
<p>An IPv6 address begins with improper compression.
<p class=example id=example-invalid-compressed-ipv6-address>"<code>https://[:1]</code>"
<td>
<tr>
<td><dfn>IPv6-too-many-pieces</dfn>
<td>
<p>An IPv6 address contains more than 8 pieces.
<p class=example id=example-ipv6-too-many-pieces>"<code>https://[1:2:3:4:5:6:7:8:9]</code>"
<td>
<tr>
<td><dfn>IPv6-multiple-compression</dfn>
<td>
<p>An IPv6 address is compressed in more than one spot.
<p class=example id=example-ipv6-multiple-compression>"<code>https://[1::1::1]</code>"
<td>
<tr>
<td><dfn>IPv4-in-IPv6-empty-part</dfn>
<td>
<p>An IPv6 address that contains an IPv4 address has an empty part in the IPv4 address.
<p class=example id=example-ipv4-in-ipv6-empty-part>"<code>https://[ffff::.0.0.1]</code>"
<td>
<tr>
<td><dfn>IPv4-in-IPv6-too-many-pieces</dfn>
<td>
<p>An IPv6 address contains an IPv4 address and the IPv6 address has more than 6 pieces.
<p class=example id=example-ipv4-in-ipv6-too-many-pieces>"<code>https://[1:1:1:1:1:1:1:127.0.0.1]</code>"
<td>
<tr>
<td><dfn>IPv6-unexpected-eof</dfn>
<td>
<p>An IPv6 address unexpectedly ends.
<p class=example id=example-ipv6-unexpected-eof>"<code>https://[1:2:3:]</code>"
<td>
<tr>
<td><dfn>IPv6-unexpected-delimiter</dfn>
<td>
<p>An IPv6 address contains a code point that is neither an <a>ASCII hex digit</a> nor a
U+003A (:).
<p class=example id=example-ipv6-unexpected-delimiter>"<code>https://[1:2:3!:4]</code>"
<td>
<tr>
<td><dfn>IPv6-too-few-pieces</dfn>
<td>
<p>An uncompressed IPv6 address contains fewer than 8 pieces.
<p class=example id=example-ipv6-too-few-pieces>"<code>https://[1:2:3]</code>"
<td>
<tr>
<td><dfn id=validation-error-forbidden-host-code-point>forbidden-host-code-point</dfn>
<td>
<p>When an <a>opaque host</a> (in a URL that <a>is not special</a>) contains a
<a>forbidden host code point</a>.
<p class=example id=example-forbidden-host-code-point>"<code>foo://exa[mple.org</code>"
<td>
<tr>
<td><dfn>IPv4-in-IPv6-too-many-parts</dfn>
<td>
<p>An IPv6 address contains an IPv4 address and the IPv4 address has more than 4 parts.
<p class=example id=example-ipv4-in-ipv6-too-many-parts>"<code>https://[ffff::127.0.0.1.2]</code>"
<td>
<tr>
<td><dfn>IPv4-in-IPv6-unexpected-code-point</dfn>
<td>
<p>An IPv6 address contains an IPv4 address of which a part contain a code point other than an
<a>ASCII digits</a> or is the empty string.
<p class=example id=example-ipv4-in-ipv6-unexpected-code-point>"<code>https://[ffff::127.0.xyz.1]</code>"
<td>
<tr>
<td><dfn>IPv4-in-IPv6-invalid-first-part</dfn>
<td>
<p>The first part of an IPv4 address that is contained within an IPv6 address is 0.
<p class=example id=example-ipv4-in-ipv6-invalid-first-part>"<code>https://[ffff::0.0.0.1]</code>"
<td>
<tr>
<td><dfn>IPv4-in-IPv6-part-out-of-range</dfn>
<td>
<p>An IPv4 address contained within an IPv6 address contains a part that exceeds 255.
<p class=example id=example-ipv4-in-ipv6-part-out-of-range>"<code>https://[ffff::127.0.0.4000]</code>"
<td>
<tr>
<td><dfn>IPv4-in-IPv6-too-few-parts</dfn>
<td>
<p>An IPv4 address contained within an IPv6 address does not contain exactly 4 parts.
<p class=example id=example-ipv4-in-ipv6-too-few-parts>"<code>https://[ffff::127.0.0]</code>"
<td>
</table>


Expand Down Expand Up @@ -1127,16 +1160,16 @@ return value of the <a for=/>host parser</a> is an <a for=/>IPv4 address</a>.
<p>If the last <a for=list>item</a> in <var>parts</var> is the empty string, then:

<ol>
<li><p><a>Validation error</a>.
<li><p><a>Empty-IPv4-part</a> <a>validation error</a>.

<li><p>If <var>parts</var>'s <a for=list>size</a> is greater than 1, then <a for=list>remove</a>
the last <a for=list>item</a> from <var>parts</var>.
<!-- Since the IPv4 parser is not to be invoked directly the input cannot be the empty string,
but if it somehow is this conditional makes sure we can keep going. -->
</ol>

<li><p>If <var>parts</var>'s <a for=list>size</a> is greater than 4, <a>validation error</a>,
return failure.
<li><p>If <var>parts</var>'s <a for=list>size</a> is greater than 4, <a>too-many-IPv4-parts</a>
<a>validation error</a>, return failure.

<li><p>Let <var>numbers</var> be an empty <a for=/>list</a>.

Expand All @@ -1147,10 +1180,10 @@ return value of the <a for=/>host parser</a> is an <a for=/>IPv4 address</a>.
<li><p>Let <var>result</var> be the result of <a lt="IPv4 number parser">parsing</a>
<var>part</var>.

<li><p>If <var>result</var> is failure, <a>validation error</a>, return failure.
<li><p>If <var>result</var> is failure, <a>non-numeric-IPv4-part</a> <a>validation error</a>,
return failure.

<li><p>If <var>result</var>[1] is true, <a>unexpected-non-decimal-number</a>
<a>validation error</a>.
<li><p>If <var>result</var>[1] is true, <a>non-decimal-IPv4-part</a> <a>validation error</a>.

<li><p><a for=list>Append</a> <var>result</var>[0] to <var>numbers</var>.
</ol>
Expand All @@ -1162,8 +1195,7 @@ return value of the <a for=/>host parser</a> is an <a for=/>IPv4 address</a>.
return failure.

<li><p>If the last <a for=list>item</a> in <var>numbers</var> is greater than or equal to
256<sup>(5 &minus; <var>numbers</var>'s <a for=list>size</a>)</sup>,
<a>IPv4-part-out-of-range</a> <a>validation error</a>, return failure.
256<sup>(5 &minus; <var>numbers</var>'s <a for=list>size</a>)</sup>, then return failure.

<li><p>Let <var>ipv4</var> be the last <a for=list>item</a> in <var>numbers</var>.

Expand Down Expand Up @@ -1368,7 +1400,7 @@ actually doing that with the editors of this document first.
<ol>
<li><p>Increase <var>pointer</var> by 1.

<li><p>If <a>c</a> is the <a>EOF code point</a>, <a>IPv6-unexpected-eof</a>
<li><p>If <a>c</a> is the <a>EOF code point</a>, <a>IPv6-unexpected-EOF</a>
<a>validation error</a>, return failure.
</ol>

Expand Down

0 comments on commit 7954d0a

Please sign in to comment.