hickory-dns
hickory-dns copied to clipboard
<&str as IntoName>::into_name("1.2.3.4") returns Ok(_)
Per RFC 1123 section 2.1:
If a dotted-decimal number can be entered without such identifying delimiters, then a full syntactic check must be made, because a segment of a host domain name is now allowed to begin with a digit and could legally be entirely numeric (see Section 6.1.2.4). However, a valid host name can never have the dotted-decimal form #.#.#.#, since at least the highest-level component label will be alphabetic.
The current implementation does not reject this.
I suppose we can add a check for this. I don't have any issue with that. It would need to come on the next release boundary though.
Quite a good sum up of the actual "state of the art" https://stackoverflow.com/questions/9071279/number-in-the-top-level-domain Some possible possibilities: (not a maintainer nor contributor to trustdns just making suggestions)
- Have a list of "now valid TLD to check against" like Firefox/chromium (don't know it's still the case)
- Try to find the good parsing of the last label in case of FQDN.
- Or having something like a
fn is_rfc1123_hostname()
regex/parser based solution to check if needed if aName
is valid like in PowerDNS.
That’s a really helpful link. Thanks for sharing.