> | So, what did we do by default: allow "_" in hostnames when that's > | explicitly against standard, or not? > > Which standard?
952, referred to from 1123. > There's RFC952 that specifies the format of HOSTS.TXT (from 1985). > (The update in Hosts Requirements isn't material, one way or the other, here.) > > What else? In fact, aside from being listed in HOSTS.TXT, what exactly > is a hostname? Is it defined somewhere? I beleive that in the context of the DNS, the customary definition of a hostname is a DNS name which has either an A or a AAAA record registered on it. If I'm not much mistaken, that's the interpretation implemented by BIND's "check-names" feature: when turned on, it allows underscores in DNS names as long as those names don't have A or AAAA information registered on them, but either complains or errs depending on the value of the option in BINDs configuration. > But library functions, like the resolver library, and getaddrinfo(), > and the older variants, have no idea why the DNS is being consulted, they > don't know, generally, what rules are intended to apply - they cannot > possibly legitimately object to anything (getaddrinfo() when given a port > as well might guess what rules might apply, but even then it cannot know > for sure .. the name it is being looked up, if the port is "http" (or 80) > or "https" (or 443) then the name being looked up might be the hostname > from a URL, which has some syntax constraints, or it might be the name > configured as the local proxy server, which does not - it is just a key to > use to extract an address from the DNS.) > > There is no rational way that those functions can ever validate name > syntax, and get it correct. I'm not entirely certain I agree. If you're looking up A or AAAA information, you're looking up a host name, and some syntactical restrictions may apply (optionally turned on/off?) if you wish to adhere to the restrictions in RFC 952. If you're looking up other information in DNS, I agree that there should be no restrictions on the name being looked up, ref. section 11 in RFC 2187. Regards, - HÃ¥vard