-
-
Notifications
You must be signed in to change notification settings - Fork 83
Description
PSL algorithm, https://github.com/publicsuffix/list/wiki/Format#note-3:
Note 3
[...] looking upexample.comshould yieldcomwhile looking upexample.com.should yieldcom.as the public suffix.
WHATWG URL standard, https://url.spec.whatwg.org/#host-registrable-domain:
To obtain the registrable domain of a host host, run these steps. [...]
...
2. Let trailingDot be "." if host ends with "."; otherwise the empty string.
...
5. Return registrableDomain and trailingDot concatenated.Example:
Host input | Public suffix | Registrable domain
example.com. | com. | example.com.
Real-life implementations agree, too: testing out on latest versions of Chrome and Firefox, there's a different cookie jar per domain with and without a trailing dot. See response.ee. proof of concept (try out the same generated response with response.ee and response.ee.).
Test code, index.mjs:
import psl from 'psl';
console.log(psl.parse("example.com."))
console.log(psl.get("example.com."))Current output:
{
input: 'example.com.',
tld: 'com',
sld: 'example',
domain: 'example.com',
subdomain: null,
listed: true
}
example.comExpected output:
{
input: 'example.com.',
tld: 'com.', // trailing "." added
sld: 'example',
domain: 'example.com.', // trailing "." added
subdomain: null,
listed: true
}
example.com. // trailing "." added