Closed jonasbb closed 7 years ago
Thanks for the pull request. I'm sorry I couldn't address this earlier due to other commitments. This is now fixed in v1.4.0
.
I am not sure if the possibility to create
Domain
structs which are invalid is wanted
Indeed. Some people, myself included, are using this library to validate "registrable" domain names. As such, domain.root()
must only return registrable domain names.
The validating could be made a bit more strict, by extending Domain::has_valid_syntax() to have a flag which ignores the regexset but performs the rest of the validation.
As per the RFC you linked to, the only restriction we should impose is making sure that DNS labels and total length are within the specified length. Other than that, libraries like this one must allow any string to pass. The new implementation for List::parse_dns_name tries to adhere to that.
This tries to address https://github.com/rushmorem/publicsuffix/issues/6
I tried to keep the API changes minimal, although I am not sure if the possibility to create
Domain
structs which are invalid is wanted, but it was the simplest way to implement it.The validating could be made a bit more strict, by extending
Domain::has_valid_syntax()
to have a flag which ignores the regexset but performs the rest of the validation.