Re: [squid-users] Add a prefix/suffix if a domain is not resolved?

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Sun, 09 Aug 2009 23:41:17 +1200

Olivier Sannier wrote:
> Hum, it seems there is a misunderstanding here.

Yes. You seem to misunderstand how domain names work...

> I do not want to always add www. in front of the domain name, I want it
> tried if it's not already there. Here is the scenario :
>
> I type in "domain".
> This does not resolve to anything, so I want Squid to try with ".com"
> appended, that is try with "domain.com". Only .com is to be tried, not
> all the possible suffixes. If "domain.com" resolves in DNS, then it
> stops there and connects to it.
> If the "domain.com" did not resolve to anything in DNS, then try again
> with "www." prefixed this time, thus giving "www.domain.com". If that
> does not resolve either, then stop there.
>
> Now, if I type in "domain.eu", then I don't want it to try with .com
> appended because there already is an extension. However, if that
> "domain.eu" does not get DNS resolution, then I want the "www." prefix
> part to apply.
> And finally, if I type "sometld.domain.ext", I don't want it to try
> anything, even if it does not resolve.

3 seconds additional loading time later you realize that the French
(Secretary general?) (http://domain.eu/) are having a little DNS trouble
and Squid is sending you to the domain squatter at http://domain.eu.com/
for the next three months.

   (see for yoruself, visit both those websites).

The only three rules about domain names is that they contain certain
readable characters, separated by dot at each ownership level, and there
is no more than 255 letters between each dot.

* by "ownership level" it means: my domain name (treenet.co.nz) is sold
by the NZ government (nz) to DomainNZ (co.nz) who sub-leased it to me
(treenet.co.nz) who runs a website (http://treenet.co.nz/)

Lets put it this way since you like examples...

Here are a couple of very real domain names:

   http://hk/ -- Hong Kong .hk domain registry
   http://www.com/ -- verisign .com registry
   http://www.com.au/ -- optus networks
   http://com.au/ -- optus networks
   http://www.co.nz/ -- a local bank

Luckily OptusNet own both domains, so it does not matter if you add www
to them.

The bank is a different story; co.nz is owned by another business, but
without a website there so far. That might change at any time. They have
been talking about it.

Here is a case where that has actually happened already.
3 _different_ websites with very different owners around the planet.

   http://tm/ - a Turkmenistan community help network
   http://tm.com/ - a North American advertising co.
   http://tm.com.my/ - a Malaysian ISP

I have just downloaded a web page from all URL links I mention above, so
they are currently operating. There used to be cool domain at just
"http://com/" as well but it seems to be dead now.

One of my most popular customers has 7 dots following the www.
Like this:
   www.a.b.c.d.e.f.g

... but only on some of their sites does www work, others it won't. Some
need it to be there, most don't. The domain itself ends in .net, but
often contain .com it mid-way down.

So to repeat;
  Squid will _already_ try the exact domain you gave it, then try each
of a set of possible right-hand sides.
  Squid cannot determine automatically when a left-hand side is missing
what should or should not be there as part of the domain.
  Squid will _already_ add the http:// part under certain circumstances
if its missing.

We will not be making Squid do it any other way, because:
  * 280 possible right-hand side of a domain. resolv.conf offers a nice
clean way to solve the problem.
  * 987 possible left-hand sides. even when cut down to just the
registered services like www, ftp, http, _http, _http._tcp etc.
  * Both those numbers are growing.
  * A single failed DNS lookup can slow Squid by half a second.

now multiply: 280 * 987 * .5 seconds = possible web page loading time.
Please hold the line...

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE6 or 3.0.STABLE18
   Current Beta Squid 3.1.0.13
Received on Sun Aug 09 2009 - 11:41:28 MDT

This archive was generated by hypermail 2.2.0 : Sun Aug 09 2009 - 12:00:03 MDT