addr-rs / addr

Parse domain names reliably and quickly in Rust
MIT License
51 stars 12 forks source link

document that inputs are case-sensitive or convert to lowercase #18

Open jonathanstrong opened 1 year ago

jonathanstrong commented 1 year ago

I was somewhat surprised by this behavior:

$ evcxr
>> addr::parse_domain_name("GOOGLE.COM").unwrap().is_icann()
false
>> addr::parse_domain_name("google.com").unwrap().is_icann()
true

It might be a good idea to deal with input case in a more explicit way, either by documenting that the validation is case-sensitive, converting the inputs internally, or using case-insensitive comparisons.

I expect there is some reason for this (probably defined in some RFC about domain names) that would seem obvious to someone who knows, but my expectation as a new user of the library is that a parse_domain_name function would deal with the casing of the input somehow.