Ask whois.iana.org about TLDs

Recognize as a TLD any string without dots present in tld_serv_list
and new_gtlds_list.
This commit is contained in:
Marco d'Itri 2014-10-15 20:38:10 +02:00
parent 4cc74ef22a
commit 8ccab2cb13

View File

@ -496,6 +496,15 @@ char *guess_server(const char *s)
/* no dot and no hyphen means it's a NSI NIC handle or ASN (?) */
if (!strpbrk(s, ".-")) {
/* if it is a TLD or a new gTLD then ask IANA */
for (i = 0; tld_serv[i]; i += 2)
if (strcaseeq(s, tld_serv[i]))
return strdup("whois.iana.org");
for (i = 0; new_gtlds[i]; i++)
if (strcaseeq(s, new_gtlds[i]))
return strdup("whois.iana.org");
if (strncaseeq(s, "as", 2) && /* it's an AS */
(isasciidigit(s[2]) || s[2] == ' '))
return strdup(whereas(atol(s + 2)));