URL.getDomain

R

Roedy Green

There is no URL or URI method to get the domain part of an URL. What
gives? There is a method for many more obscure parts of the URL.

--
Roedy Green Canadian Mind Products
http://mindprod.com

"Don’t worry about people stealing an idea; if it’s original, you’ll have to shove it down their throats."
~ Howard Aiken (born: 1900-03-08 died: 1973-03-14 at age: 73)
 
R

RedGrittyBrick

Roedy said:
There is no URL or URI method to get the domain part of an URL. What
gives?

What gives is probably that your notion of "domain" differs slightly but
significantly from that defined in the standards.

A typical URL scheme is
resource_type://domain:port/filepathname?query_string#anchor

It is easy to extract the "domain" part of that.

This "domain" is resolved using DNS and in DNS is regarded as a Fully
Qualified Domain Name (FQDN) consisting of a hostname leaf-node followed
by an arbitrary number of domain labels joined by periods and
terminating at the DNS root domain ".", usually implicitly.

In DNS, technically, there is nothing special about any subset of the
FQDN other than the hostname leaf node. Humans may assign some meaning
to some trailing subsets such as "com" or "ford.com" but there is
nothing in the DNS data that explicitly and unambiguously marks some
subset as, for example, identifying a business organisation or legal entity.
 
R

Roedy Green

What gives is probably that your notion of "domain" differs slightly but
significantly from that defined in the standards.

On the other hand, when you register a domain name, you register
mindprod.com and all lower levels are yours too, e.g.
"java.mindprod.com".

Presumably you could extract the domain name in that sense lists of
suffixes you can register. e.g. "co.uk", "com".
--
Roedy Green Canadian Mind Products
http://mindprod.com

"Don’t worry about people stealing an idea; if it’s original, you’ll have to shove it down their throats."
~ Howard Aiken (born: 1900-03-08 died: 1973-03-14 at age: 73)
 
E

EJP

Roedy said:
There is no URL or URI method to get the domain part of an URL. What
gives? There is a method for many more obscure parts of the URL.

Because the meaning of the part after the scheme (e.g. http:) is
scheme-specific. Consider file:// - no domain there!
 
T

Tom Anderson

There isn't a single registry that lists all the "suffixes" (i.e. domains)

Wrong!

http://publicsuffix.org/

What this isn't is an *authoritative* list. It's descriptive rather than
normative.
for which subdomains can be purchased.

Oh, no, in that case, true.

But that's not what Roedy's talking about, really.
You are just as much at liberty to sell me redgrittybrick.mindprod.com as
Network Solutions LLC are to sell me redgrittybrick.com.ca.

Administratively[1], technically[2] and legally[3] there is not any
significant difference between the two.

Wrong - there is a technical difference, because it would be permitted for
you to set a cookie for mindprod.com, but not for com.ca.

I'm ignoring your footnote [2], since it limits this word to a strange an
unnatural meaning.

tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

sync on local variable 35
bugs.sun.com 11
Pithy programming Quotations 23
JDK 1.6.0_21 released 0
writing to DVD 1
What is a "fresher"? 25
string case clauses 7
Webstart terminogy 7

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,169
Latest member
ArturoOlne
Top