Skip to content

Commit

Permalink
Add support for ipv6 hostnames to the constructor string parser. (Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wanderview committed Sep 1, 2021
1 parent b091743 commit 7715449
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,8 @@ A [=constructor string parser=] has an associated <dfn export for="constructor s

A [=constructor string parser=] has an associated <dfn export for="constructor string parser">group depth</dfn>, a number, initially set to 0.

A [=constructor string parser=] has an associated <dfn export for="constructor string parser">hostname IPv6 bracket depth</dfn>, a number, initially set to 0.

A [=constructor string parser=] has an associated <dfn export for="constructor string parser">protocol matches a special scheme flag</dfn>, a boolean, initially set to false.

A [=constructor string parser=] has an associated <dfn export for="constructor string parser">state</dfn>, a string, initially set to "<a for="constructor string parser/state">`init`</a>". It must be one of the following:
Expand Down Expand Up @@ -607,7 +609,9 @@ To <dfn>parse a constructor string</dfn> given a string |input|:
</dd>
<dt>"<a for="constructor string parser/state">`hostname`</a>"</dt>
<dd>
1. If the result of running [=is a port prefix=] given |parser| is true, then run [=change state=] given |parser|, "<a for="constructor string parser/state">`port`</a>", and 1.
1. If the the result of running [=is an IPv6 open=] given |parser| is true, then increment |parser|'s [=constructor string parser/hostname IPv6 bracket depth=] by 1.
1. Else if the the result of running [=is an IPv6 close=] given |parser| is true, then decrement |parser|'s [=constructor string parser/hostname IPv6 bracket depth=] by 1.
1. Else if the result of running [=is a port prefix=] given |parser| is true and |parser|'s [=constructor string parser/hostname IPv6 bracket depth=] is zero, then run [=change state=] given |parser|, "<a for="constructor string parser/state">`port`</a>", and 1.
1. Else if the result of running [=is a pathname start=] given |parser| is true, then run [=change state=] given |parser|, "<a for="constructor string parser/state">`pathname`</a>", and 0.
1. Else if the result of running [=is a search prefix=] given |parser| is true, then run [=change state=] given |parser|, "<a for="constructor string parser/state">`search`</a>", and 1.
1. Else if the result of running [=is a hash prefix=] given |parser| is true, then run [=change state=] given |parser|, "<a for="constructor string parser/state">`hash`</a>", and 1.
Expand Down Expand Up @@ -764,6 +768,18 @@ To run <dfn>is a group close</dfn> given a [=constructor string parser=] |parser
1. Else return false.
</div>

<div algorithm>
To run <dfn>is an IPv6 open</dfn> given a [=constructor string parser=] |parser|:

1. Return the result of running [=is a non-special pattern char=] given |parser|, |parser|'s [=constructor string parser/token index=], and "`[`".
</div>

<div algorithm>
To run <dfn>is an IPv6 close</dfn> given a [=constructor string parser=] |parser|:

1. Return the result of running [=is a non-special pattern char=] given |parser|, |parser|'s [=constructor string parser/token index=], and "`]`".
</div>

<div algorithm>
To run <dfn>make a component string</dfn> given a [=constructor string parser=] |parser|:

Expand Down

0 comments on commit 7715449

Please sign in to comment.