Allow for domain name trailing dot in PublicSuffixDatabase#6111
Allow for domain name trailing dot in PublicSuffixDatabase#6111yschimke merged 4 commits intosquare:masterfrom
Conversation
| val unicodeDomain = IDN.toUnicode(domain) | ||
| val domainLabels = unicodeDomain.split('.') | ||
|
|
||
| if (domainLabels.lastOrNull() == "") { |
There was a problem hiding this comment.
There's no need for OrNull here; split always returns at least one string.
| assertThat(parse("https://127.0.0.1").topPrivateDomain()).isNull(); | ||
|
|
||
| // https://github.com/square/okhttp/issues/6109 | ||
| assertThat(parse("http://a./").topPrivateDomain()).isNull(); |
There was a problem hiding this comment.
Also test these?
a..
..a
a..b
.a
.
..
There was a problem hiding this comment.
My interpretation is that hostname ending with '.' is the one special case since it's actually the blessed form of dns, and we mostly just all agreed to drop that trailing '.'
Or is there some special behaviour we want for these?
There was a problem hiding this comment.
I really don’t know. I was mostly worried that we’d return squareup.com as the top private domain, which seemed wrong. But I’d forgotten about the trailing . thing in DNS.
Now I’m curious, What Does Guava Do?
There was a problem hiding this comment.
The awkward thing with this change is that HttpUrl parsing is our shield, but also known to be non exact. And as much as it doesn't match URI, it will be painful and cause bugs in various places e.g. calling through to JDK methods like ProxySelector.
|
Does this return the wrong answer for say, |
|
I feel like this is a strong hint :) |
Ok, you win this round Mr Swank. |
| assertThat(parse("https://127.0.0.1").topPrivateDomain()).isNull(); | ||
|
|
||
| // https://github.com/square/okhttp/issues/6109 | ||
| assertThat(parse("http://a./").topPrivateDomain()).isNull(); |
There was a problem hiding this comment.
I really don’t know. I was mostly worried that we’d return squareup.com as the top private domain, which seemed wrong. But I’d forgotten about the trailing . thing in DNS.
Now I’m curious, What Does Guava Do?
No description provided.