Re: [whatwg/url] Can a registrable domain or public suffix have a trailing dot? (Issue #693)

Totally agree that there is an opportunity for wording clarification - I hope it doesn’t seem that I’m dismissive of the problem statement. And yes, I acknowledge that’s one way to read the algorithm.

Another way to read it is that the rules are all relative to the root, therefore don’t need `.` encoded or while processing, but that the caller of the algorithm can (and in the case of browser implementations, AIUI, does) preserve the trailing `.` from inputs, since the trailing `.` is significant to resolver APIs and (in the case of unencrypted connections) the logical origin.

That is:
* The PSL always stores in root relative form
* The algorithm itself processes all labels but the empty root label of an input
* for both `example.com` and `example.com.`, the output of the PSL algorithm is `com`
* The effective TLD is formed based on the input - e.g. if the input was `example.com.`, then the root label would be appended to the output of the PSL algorithm to get the effective TLD of `com.`

Or, put differently, the length of the eTLD in the input is `len(psl_output) + (input[len] == '.' ? 1 : 0)`

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/693#issuecomment-1113299314

You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/url/issues/693/1113299314@github.com>

Received on Friday, 29 April 2022 13:17:09 UTC