weppos / publicsuffix-ruby

Domain name parser for Ruby based on the Public Suffix List.
https://simonecarletti.com/code/publicsuffix
MIT License
620 stars 109 forks source link

PublicSuffix.parse downcases domain #87

Closed postmodern closed 8 years ago

postmodern commented 8 years ago

First off, thank you for this gem. It has been a huge help. However, I recently noticed a slightly odd behavior with Capitalized domains. PublicSuffix.parse() will downcase the domain.

PublicSuffix.parse("Foo.com").domain
# => "foo.com"

I'm not sure whether that was the intended behavior?

weppos commented 8 years ago

Thanks for your kind words, @postmodern. This is unfortunately a know side effect of GH-66 and GH-62. I believe it would be possible to change the library to keep doing a lowercase comparison, but rather returning an altered result I can rely on the dots to return the appropriate result based on the unchanged input.

That's the first thing that comes to my mind. There may be better solutions. Anyway, the quick answer is that unfortunately at the moment this is expected.

weppos commented 8 years ago

@postmodern I was going to fix this issue, but I actually noticed that the official PSL acceptance tests forces lower-case conversion.

// Mixed case
'COM', null
'example.COM', 'example.com'
'WwW.example.COM', 'example.com'

I've now made this lib 100% compliant (as I'm planning to use it to officially validate the PSL itself , hence I'm going to close the issue as wontfix.

It's still possible to call the decompose manually passing the rule and the original input, or reconstruct the value using the # of dots from the ouput.