0

Let's just look at the host part, since subdomain can have unlimited levels, and there can be a different level of domains, for example:

foo.foo2.host.bar.bar2

This is a completely valid host, but while the below are also valid:

foo.foo2.foo3.host.bar.bar2
foo.foo2.host.bar.bar2.bar3

Basically, we can't really use the 'dot' to tell the difference between subdomains and domains

So without a network to actually look up the domain info from the web, is it impossible to properly parse a URI?

How does a web browser handle this situation?

Jasurbek
  • 2,946
  • 3
  • 20
  • 37
grayfox
  • 51
  • 4
  • What exactly do you mean? Why does it matter whats a subdomain and what is not? By the way, everything but the last part is a subdomain, the last part is a top level domain. – tkausl Jun 23 '19 at 10:07

1 Answers1

0

Terminology:

  • In the HTTPS URI https://m.example.com/foo, the host component is m.example.com (which is a "registered name").

  • In the registered name m.example.com, com is the top-level domain, example is the second-level domain, and m is the third-level domain. In DNS, each of these levels is called label.

  • The third-level domain (and fourth-level etc.) is typically called subdomain.

  • The term domain can refer to different things:

  • the whole thing (m.example.com)

  • the combination of top-level and second-level (example.com), possibly including additional levels (in case it’s a public suffix, like co.uk)

When you want to parse the registered name m.example.com (or as FQDN: m.example.com.), you go from right to left; each label is separated by a .:

  1. The first label is the top-level domain (com)
  2. The second label is the second-level domain (example)
  3. The third label is the third-level domain (m)
Community
  • 1
  • 1
unor
  • 92,415
  • 26
  • 211
  • 360