Domain names with dots at the end

情到浓时终转凉″ 提交于 2020-05-10 03:50:45

问题


What is the difference between:

domainname

and

domainname.

?

For instance, let's suppose msn.com and msn.com.. I tried both here:

http://http-headers.online-domain-tools.com/link/d83cbgIenbU0KGj3/

http://http-headers.online-domain-tools.com/link/d83d3g2kZ1ioLns4/

From the example above we can see that both domain names are valid. However, they are obviously not the same because the responses are different.

I believe that RFC 1035 (p. 7) defines domain names. Yet, the grammar does not allow dot at the end of a domain name.


回答1:


domainname.

Is the fully qualified domain name

Domain names ending in a dot are absolute where as the ones not ending in a dot are relative.

There's a catch though... The stub resolver default behaviour is to consider a request for any domain with at least one dot in it as being a request for an absolute domain.

So what actually happens is:

  • when you type msn.com in your browser your stub resolver will send a dns query for msn.com. and then your browser will send a HTTP request to one of the IPs provided by the dns response
  • when you type msn the domain is considered relative to your resolver's search list (see the search directive in your /etc/resolv.conf). If the search list is search foo.com bar.com your stub resolver will send a dns query for msn.foo.com. If that fails it will then send a dns query for msn.bar.com. If one of the previous dns queries succeeded your browser will send a HTTP request to one of the IPs provided by the dns response.


来源:https://stackoverflow.com/questions/19480767/domain-names-with-dots-at-the-end

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!