Re: extracting the root domain from a URL [message #171700 is a reply to message #171696] |
Sun, 16 January 2011 16:57 |
Thomas 'PointedEars'
Messages: 701 Registered: October 2010
Karma:
|
Senior Member |
|
|
Jonathan Stein wrote:
> Den 15-01-2011 00:54, Thomas 'PointedEars' Lahn skrev:
>> WHOIS would be overkill here and it is not universally supported anymore
>> (for example, DENIC dropped WHOIS support a few years ago except via
>> their website because of misuse), so you would get false positives.
>
> We don't need the actual WHOIS data,
What exactly were you suggesting, then?
> and I believe that even DENIC provides simple WHOIS status information.
I have just found out that they are doing it *again* *now* even using the
proper protocol; now they are only omitting the Admin-C record in the
output. It is a curious development, though; thank you for making me try
again.
>> The proper internet service to use here is DNS itself, of course.
>
> Depending on how Mike defines "root domain", I don't think you can do
> this reliable from DNS.
Yes, you can. That is exactly what DNS is for.
> If you look up www.example.com, and there is no A or AAAA record for
> example.com,
There is here, although not an authoritative one:
$ dig A example.com
; <<>> DiG 9.6-ESV-R3 <<>> A example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61811
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;example.com. IN A
;; ANSWER SECTION:
example.com. 172689 IN A 192.0.32.10
;; Query time: 21 msec
;; SERVER: 212.60.61.246#53(212.60.61.246)
;; WHEN: Sun Jan 16 17:46:42 2011
;; MSG SIZE rcvd: 45
> you'll get www.example.com as the "root domain".
Not here.
> Another approach would be to ask for NS records and define "root domain"
> as the highest level with an NS record. This could however include
> department.example.com, which might not be what Mike intended...
Exactly. It would be best to find out the highest-level domain name with a
name server (which WHOIS can, but need not provide) and ask that name server
about the sub-level domain. Or trust DNS so far as to ask the nearest name
server for a recursive lookup.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
|
|
|