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

Domain validation is wrong #116

Closed strikyflo closed 8 years ago

strikyflo commented 8 years ago

Hi,

I can validate that "-a.com" is valid domain name using PublicSuffix gem. Therefore it's absolutely not valid, according to the RFC, stackoverflow and any registrar. Same goes with 'a-.com'

Thank you :)

weppos commented 8 years ago

The syntax validation of a domain name according to the RFC is beyond the scope of this library.

See https://github.com/weppos/publicsuffix-ruby/issues/41

vveliev commented 8 years ago

what is the purpose of .valid?

weppos commented 8 years ago

Have a look at https://github.com/weppos/publicsuffix-ruby/blob/master/lib/public_suffix.rb#L118

Essentially, it validates whether the input is valid according to the PSL rules.