Re: [whatwg/url] Define hosts' public suffix and registrable domain. (#391)

annevk commented on this pull request.

Thanks, I mostly have nits.

Do we need public suffix as a concept in practice? I haven't seen the need for that so far, but if we add an API it would make sense.

> @@ -272,6 +272,97 @@ for further processing.
 U+0020 SPACE, U+0023 (#), U+0025 (%), U+002F (/), U+003A (:), U+003F (?), U+0040 (@), U+005B ([),
 U+005C (\), or U+005D (]).
 
+<p>A <a for=/>host</a>'s <dfn for=host export id=concept-host-public-suffix>public suffix</dfn> is
+the portion of a <a for=/>host</a> which is controlled by a registrar, public or otherwise. To
+obtain <var>host</var>'s <a for=host>public suffix</a>, run the following steps:
+
+<ol>
+ <li><p>Let <var>parsed</var> be the result of <a lt="host parser">host parsing</a> <var>host</var>.

A host is already parsed (otherwise it wouldn't be a host). You also need to introduce the _host_ variable in the paragraph before the algorithm.

> +
+<ol>
+ <li><p>Let <var>parsed</var> be the result of <a lt="host parser">host parsing</a> <var>host</var>.
+
+ <li><p>If <var>parsed</var> is not a <a>domain</a>, return the empty string.
+
+ <li><p>Return the <a for=host>public suffix</a> obtained by executing the
+ <a href="https://publicsuffix.org/list/">algorithm</a> defined by the Public Suffix List. [[!PSL]].
+</ol>
+
+<p>A <a for=/>host</a>'s <dfn for=host export id=concept-host-registrable-domain>registrable
+domain</dfn> is a formally valid domain name that could be registered at a registry. To obtain
+<var>host</var>'s <a for=host>registrable domain</a>, run the following steps:
+
+<ol>
+ <li><p>Let <var>parsed</var> be the result of <a lt="host parser">host parsing</a> <var>host</var>.

Same comment as above.

> @@ -272,6 +272,97 @@ for further processing.
 U+0020 SPACE, U+0023 (#), U+0025 (%), U+002F (/), U+003A (:), U+003F (?), U+0040 (@), U+005B ([),
 U+005C (\), or U+005D (]).
 
+<p>A <a for=/>host</a>'s <dfn for=host export id=concept-host-public-suffix>public suffix</dfn> is
+the portion of a <a for=/>host</a> which is controlled by a registrar, public or otherwise. To
+obtain <var>host</var>'s <a for=host>public suffix</a>, run the following steps:
+
+<ol>
+ <li><p>Let <var>parsed</var> be the result of <a lt="host parser">host parsing</a> <var>host</var>.
+
+ <li><p>If <var>parsed</var> is not a <a>domain</a>, return the empty string.

This kind of implies that the public suffix is also a string. Perhaps it's cleaner to return null?

> +   <td><code>com</code>
+   <td>
+  <tr>
+   <td><code>example.com</code>
+   <td><code>com</code>
+   <td><code>example.com</code>
+  <tr>
+   <td><code>www.example.com</code>
+   <td><code>com</code>
+   <td><code>example.com</code>
+  <tr>
+   <td><code>sub.www.example.com</code>
+   <td><code>com</code>
+   <td><code>example.com</code>
+  <tr>
+   <td><code>EXAMPLE.COM</code>

This is not a host, but input to the host parser.

> +   <td><code>com</code>
+   <td><code>example.com</code>
+  <tr>
+   <td><code>github.io</code>
+   <td><code>github.io</code>
+   <td>
+  <tr>
+   <td><code>whatwg.github.io</code>
+   <td><code>github.io</code>
+   <td><code>whatwg.github.io</code>
+  <tr>
+   <td><code>whatwg.github.io</code>
+   <td><code>github.io</code>
+   <td><code>whatwg.github.io</code>
+  <tr>
+   <td><code>إختبار</code>

Same as above. And also applies below.

> +   <td><code>إختبار</code>
+   <td><code>xn-kgbechtv</code>
+   <td>
+  <tr>
+   <td><code>example.إختبار</code>
+   <td><code>xn-kgbechtv</code>
+   <td><code>example.xn-kgbechtv</code>
+  <tr>
+   <td><code>sub.example.إختبار</code>
+   <td><code>xn-kgbechtv</code>
+   <td><code>example.xn-kgbechtv</code>
+ </table>
+</div>
+
+<p>Two <a for=/>hosts</a>, <var>A</var> and <var>B</var> are said to be
+<dfn for=host export id=concept-host-same-site>same-site</dfn> with each other if either of the

We have it as "same origin". Should this be "same site"?

> +   <td><code>example.إختبار</code>
+   <td><code>xn-kgbechtv</code>
+   <td><code>example.xn-kgbechtv</code>
+  <tr>
+   <td><code>sub.example.إختبار</code>
+   <td><code>xn-kgbechtv</code>
+   <td><code>example.xn-kgbechtv</code>
+ </table>
+</div>
+
+<p>Two <a for=/>hosts</a>, <var>A</var> and <var>B</var> are said to be
+<dfn for=host export id=concept-host-same-site>same-site</dfn> with each other if either of the
+following statements are true:
+
+<ul class=brief>
+ <li><p><var>A</var> is identical to <var>B</var>

This should use concept-host-equals.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/pull/391#pullrequestreview-123307438

Received on Friday, 25 May 2018 09:49:10 UTC