summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco d'Itri <md@linux.it>2014-04-23 06:23:15 +0200
committerMarco d'Itri <md@linux.it>2014-05-02 04:26:50 +0200
commit171705cbde06ef350f2e34ae76070a41a681c35f (patch)
tree2ba4a599bd1bc0967fab2a332bd0613cfb0c9367
parent4411a41702622293eb280c0c5aa6ad48d9dd3403 (diff)
downloadwhois-171705cbde06ef350f2e34ae76070a41a681c35f.tar.gz
Use whois.nic.$TLD for the "new" gTLDs
The "new" gTLDs are contractually required by ICANN to provide port 43 whois service on this standard domain.
-rw-r--r--.gitignore1
-rw-r--r--Makefile3
-rw-r--r--data.h5
-rwxr-xr-xmake_new_gtlds.pl16
-rw-r--r--new_gtlds_list266
-rw-r--r--whois.c32
-rw-r--r--whois.h1
7 files changed, 324 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index f990909..dabbc22 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
*_del.h
+new_gtlds.h
tld_serv.h
servers_charset.h
version.h
diff --git a/Makefile b/Makefile
index d71d81d..8f1ca35 100644
--- a/Makefile
+++ b/Makefile
@@ -84,6 +84,9 @@ ip_del.h: ip_del_list make_ip_del.pl
ip6_del.h: ip6_del_list make_ip6_del.pl
$(PERL) make_ip6_del.pl < $< > $@
+new_gtlds.h: new_gtlds_list make_new_gtlds.pl
+ $(PERL) make_new_gtlds.pl < $< > $@
+
tld_serv.h: tld_serv_list make_tld_serv.pl
$(PERL) make_tld_serv.pl < $< > $@
diff --git a/data.h b/data.h
index d25c6dc..96178d2 100644
--- a/data.h
+++ b/data.h
@@ -134,6 +134,11 @@ const struct as32_del as32_assign[] = {
{ 0, 0, NULL }
};
+const char *new_gtlds[] = {
+#include "new_gtlds.h"
+ NULL
+};
+
const char *tld_serv[] = {
#include "tld_serv.h"
NULL, NULL
diff --git a/make_new_gtlds.pl b/make_new_gtlds.pl
new file mode 100755
index 0000000..964a2f7
--- /dev/null
+++ b/make_new_gtlds.pl
@@ -0,0 +1,16 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+while (<>) {
+ chomp;
+ s/#.*$//;
+ s/^\s+//; s/\s+$//;
+ next if /^$/;
+
+ die "format error: $_" if not /^((?:xn--)?[a-z0-9]+)$/;
+
+ print qq| ".$_",\n|;
+}
+
diff --git a/new_gtlds_list b/new_gtlds_list
new file mode 100644
index 0000000..d545419
--- /dev/null
+++ b/new_gtlds_list
@@ -0,0 +1,266 @@
+# If a TLD is listed in this file then queries will go to whois.nic.$TLD.
+# All "new" gTLDs are mandated by the ICANN contract to provide port 43 and
+# web-based whois service on this standard domain.
+# Any exceptions can be handled in tld_serv_list as usual, since it will
+# be checked first.
+
+academy
+actor
+agency
+airforce
+archi
+associates
+axa
+bar
+bargains
+berlin
+best
+bid
+bike
+black
+blackfriday
+blue
+boutique
+build
+builders
+buzz
+cab
+camera
+camp
+capital
+cards
+care
+career
+careers
+cash
+catering
+center
+ceo
+cheap
+christmas
+citic
+cleaning
+clinic
+clothing
+club
+codes
+coffee
+college
+cologne
+com
+community
+company
+computer
+condos
+construction
+consulting
+contractors
+cooking
+cool
+country
+creditcard
+cruises
+dance
+dating
+democrat
+dental
+desi
+diamonds
+directory
+discount
+dnp
+domains
+education
+email
+engineering
+enterprises
+equipment
+estate
+eus
+events
+exchange
+expert
+exposed
+fail
+farm
+feedback
+finance
+financial
+fish
+fishing
+fitness
+flights
+florist
+foo
+foundation
+frogans
+fund
+furniture
+futbol
+gal
+gallery
+gift
+glass
+gop
+graphics
+gratis
+gripe
+guitars
+guru
+haus
+holdings
+holiday
+horse
+house
+immobilien
+industries
+info
+ink
+institute
+insure
+international
+investments
+jetzt
+kaufen
+kim
+kitchen
+kiwi
+koeln
+kred
+land
+lease
+lighting
+limited
+limo
+link
+london
+luxury
+maison
+management
+mango
+marketing
+media
+meet
+menu
+miami
+moda
+moe
+monash
+moscow
+nagoya
+net
+neustar
+ninja
+nyc
+okinawa
+onl
+org
+paris
+partners
+parts
+photo
+photography
+photos
+pics
+pictures
+pink
+plumbing
+productions
+properties
+pub
+qpon
+quebec
+recipes
+red
+reisen
+ren
+rentals
+repair
+report
+rest
+reviews
+rich
+rocks
+rodeo
+ruhr
+ryukyu
+saarland
+schule
+services
+sexy
+shiksha
+shoes
+singles
+social
+sohu
+solar
+solutions
+soy
+supplies
+supply
+support
+surgery
+systems
+tattoo
+tax
+technology
+tienda
+tips
+today
+tokyo
+tools
+town
+toys
+trade
+training
+university
+uno
+vacations
+vegas
+ventures
+viajes
+villas
+vision
+vodka
+vote
+voting
+voto
+voyage
+wang
+watch
+webcam
+wed
+wien
+wiki
+works
+wtc
+wtf
+xn--3bst00m
+xn--3ds443g
+xn--55qw42g
+xn--55qx5d
+xn--6frz82g
+xn--6qq986b3xl
+xn--80adxhks
+xn--80asehdb
+xn--80aswg
+xn--c1avg
+xn--cg4bki
+xn--czru2d
+xn--d1acj3b
+xn--fiq228c5hs
+xn--fiq64b
+xn--i1b6b1a6a2e
+xn--io0a7i
+xn--mgbab2bd
+xn--ngbc5azd
+xn--nqv7f
+xn--nqv7fs00ema
+xn--q9jyb4c
+xn--rhqv96g
+xn--ses554g
+xn--unup4y
+xn--zfr164b
+xyz
+yokohama
+zone
diff --git a/whois.c b/whois.c
index e1fb9e3..7476ca2 100644
--- a/whois.c
+++ b/whois.c
@@ -459,6 +459,21 @@ char *guess_server(const char *s)
if (domcmp(s, tld_serv[i]))
return strdup(tld_serv[i + 1]);
+ /* use the default server name for "new" gTLDs */
+ if (is_new_gtld(s)) {
+ char *server;
+ const char *p, *tld = NULL;
+
+ for (p = s; *p; p++) /* look for the TLD */
+ if (*p == '.')
+ tld = p;
+
+ server = malloc(strlen("whois.nic") + strlen(tld) + 1);
+ strcpy(server, "whois.nic");
+ strcat(server, tld);
+ return(server);
+ }
+
/* no dot but hyphen */
if (!strchr(s, '.')) {
/* search for strings at the start of the word */
@@ -535,6 +550,12 @@ char *queryformat(const char *server, const char *flags, const char *query)
}
break;
}
+
+ /* Use UTF-8 by default for "new" gTLDs */
+ if (!simple_recode_input_charset && /* was not in the database */
+ !strchr(query, ' ') && /* and has no parameters */
+ is_new_gtld(query)) /* and is a "new" gTLD: */
+ simple_recode_input_charset = "utf-8"; /* then try UTF-8 */
#endif
#ifdef HAVE_LIBIDN
@@ -957,6 +978,17 @@ int domcmp(const char *dom, const char *tld)
return 0;
}
+int is_new_gtld(const char *s)
+{
+ int i;
+
+ for (i = 0; new_gtlds[i]; i++)
+ if (domcmp(s, new_gtlds[i]))
+ return 1;
+
+ return 0;
+}
+
/*
* Attempt to normalize a query by removing trailing dots and whitespace,
* then convert the domain to punycode.
diff --git a/whois.h b/whois.h
index a9b9a64..cec65b3 100644
--- a/whois.h
+++ b/whois.h
@@ -28,6 +28,7 @@ unsigned long myinet_aton(const char *);
unsigned long asn32_to_long(const char *);
int isasciidigit(const char);
int domcmp(const char *, const char *);
+int is_new_gtld(const char *);
int domfind(const char *, const char *[]);
char *normalize_domain(const char *);
char *convert_6to4(const char *);