@@ -414,7 +414,8 @@ point <a for=/>URLs</a> from <var>A</var> can come from untrusted sources.
414
414
415
415
<div class=example id=example-host-parsing>
416
416
<p> A <a lt="host parser">parse</a> -<a lt="host serializer">serialize</a> roundtrip gives the
417
- following results, depending on the <var> isNotSpecial</var> argument to the <a>host parser</a> :
417
+ following results, depending on the <var ignore> isNotSpecial</var> argument to the
418
+ <a>host parser</a> :
418
419
419
420
<table>
420
421
<tr>
@@ -732,9 +733,10 @@ to be distinguished.
732
733
733
734
<h3 id=host-parsing>Host parsing</h3>
734
735
736
+ <div algorithm>
735
737
<p> The <dfn export id=concept-host-parser lt="host parser|host parsing">host parser</dfn> takes a
736
738
<a>scalar value string</a> <var> input</var> with an optional boolean <var> isNotSpecial</var>
737
- (default false), and then runs these steps:
739
+ (default false), and then runs these steps. They return failure or a <a for=/>host</a> .
738
740
739
741
<ol>
740
742
<li>
@@ -772,11 +774,13 @@ to be distinguished.
772
774
773
775
<li><p> Return <var> asciiDomain</var> .
774
776
</ol>
777
+ </div>
775
778
776
779
<hr>
777
780
781
+ <div algorithm>
778
782
<p> The <dfn>ends in a number checker</dfn> takes an <a>ASCII string</a> <var> input</var> and then
779
- runs these steps:
783
+ runs these steps. They return a boolean.
780
784
781
785
<ol>
782
786
<li><p> Let <var> parts</var> be the result of <a>strictly splitting</a> <var> input</var> on
@@ -808,26 +812,24 @@ runs these steps:
808
812
809
813
<li><p> Return false.
810
814
</ol>
815
+ </div>
811
816
817
+ <div algorithm>
812
818
<p> The <dfn id=concept-ipv4-parser>IPv4 parser</dfn> takes an <a>ASCII string</a> <var> input</var>
813
- and then runs these steps:
819
+ and then runs these steps. They return failure or an <a for=/>IPv4 address</a> .
814
820
815
- <ol>
816
- <li>
817
- <p> Let <var> validationError</var> be false.
818
-
819
- <p class=note> This uses <var> validationError</var> to track <a>validation errors</a> to avoid
820
- reporting them before we are confident we want to parse <var> input</var> as an IPv4 address as the
821
- <a>host parser</a> almost always invokes the <a>IPv4 parser</a> .
821
+ <p class=note> The <a for=/>IPv4 parser</a> is not to be invoked directly. Instead check that the
822
+ return value of the <a for=/>host parser</a> is an <a for=/>IPv4 address</a> .
822
823
824
+ <ol>
823
825
<li><p> Let <var> parts</var> be the result of <a>strictly splitting</a> <var> input</var> on
824
826
U+002E (.).
825
827
826
828
<li>
827
829
<p> If the last <a for=list>item</a> in <var> parts</var> is the empty string, then:
828
830
829
831
<ol>
830
- <li><p> Set <var> validationError </var> to true .
832
+ <li><p> <a>Validation error</a> .
831
833
832
834
<li><p> If <var> parts</var> 's <a for=list>size</a> is greater than 1, then <a for=list>remove</a>
833
835
the last <a for=list>item</a> from <var> parts</var> .
@@ -849,18 +851,11 @@ and then runs these steps:
849
851
850
852
<li><p> If <var> result</var> is failure, <a>validation error</a> , return failure.
851
853
852
- <li><p> If <var> result</var> [1] is true, then set <var> validationError </var> to true .
854
+ <li><p> If <var> result</var> [1] is true, <a>validation error</a> .
853
855
854
856
<li><p> <a for=list>Append</a> <var> result</var> [0] to <var> numbers</var> .
855
857
</ol>
856
858
857
- <li>
858
- <p> If <var> validationError</var> is true, <a>validation error</a> .
859
-
860
- <p class="note"> At this point each part was parsed into a number and <var> input</var> will be
861
- treated as an IPv4 address (or failure). And therefore error reporting resumes.
862
- </li>
863
-
864
859
<li><p> If any item in <var> numbers</var> is greater than 255, <a>validation error</a> .
865
860
866
861
<li><p> If any but the last <a for=list>item</a> in <var> numbers</var> is greater than 255, then
@@ -888,7 +883,9 @@ and then runs these steps:
888
883
889
884
<li><p> Return <var> ipv4</var> .
890
885
</ol>
886
+ </div>
891
887
888
+ <div algorithm>
892
889
<p> The <dfn>IPv4 number parser</dfn> takes an <a>ASCII string</a> <var> input</var> and then runs
893
890
these steps:
894
891
@@ -939,11 +936,16 @@ these steps:
939
936
940
937
<li><p> Return (<var> output</var> , <var> validationError</var> ).
941
938
</ol>
939
+ </div>
942
940
943
941
<hr>
944
942
943
+ <div algorithm>
945
944
<p> The <dfn id=concept-ipv6-parser>IPv6 parser</dfn> takes a <a>scalar value string</a>
946
- <var> input</var> and then runs these steps:
945
+ <var> input</var> and then runs these steps. They return failure or an <a for=/>IPv6 address</a> .
946
+
947
+ <p class=note> The <a for=/>IPv6 parser</a> could in theory be invoked directly, but please discuss
948
+ actually doing that with the editors of this document first.
947
949
948
950
<ol>
949
951
<li><p> Let <var> address</var> be a new <a>IPv6 address</a> whose <a>IPv6 pieces</a> are all 0.
@@ -1089,11 +1091,14 @@ these steps:
1089
1091
1090
1092
<li><p> Return <var> address</var> .
1091
1093
</ol>
1094
+ </div>
1092
1095
1093
1096
<hr>
1094
1097
1098
+ <div algorithm>
1095
1099
<p> The <dfn export id=concept-opaque-host-parser>opaque-host parser</dfn> takes a
1096
- <a>scalar value string</a> <var> input</var> , and then runs these steps:
1100
+ <a>scalar value string</a> <var> input</var> , and then runs these steps. They return failure or an
1101
+ <a for=/>opaque host</a> .
1097
1102
1098
1103
<ol>
1099
1104
<li><p> If <var> input</var> contains a <a>forbidden host code point</a> ,
@@ -1108,6 +1113,7 @@ these steps:
1108
1113
<li><p> Return the result of running <a for=string>UTF-8 percent-encode</a> on <var> input</var>
1109
1114
using the <a>C0 control percent-encode set</a> .
1110
1115
</ol>
1116
+ </div>
1111
1117
1112
1118
1113
1119
<h3 id=host-serializing>Host serializing</h3>
0 commit comments