根据RFC 1738: Uniform Resource Locators (URL): 3.1. Common Internet Scheme Syntax,主机组件是否必须包含一个点,例如“example.com”?即,它可能只由一个域名标签组成吗?
答案 0 :(得分:2)
不,主机不必包含点。即,是的,只有一个域名标签可以。查看domain
,subdomain
和label
(http://tools.ietf.org/html/rfc1034#section-3.5):
<domain> ::= <subdomain> | " "
<subdomain> ::= <label> | <subdomain> "." <label>
<label> ::= <letter> [ [ <ldh-str> ] <let-dig> ]
<ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
<let-dig-hyp> ::= <let-dig> | "-"
<let-dig> ::= <letter> | <digit>
<letter> ::= any one of the 52 alphabetic characters A through Z in upper case and a through z in lower case
<digit> ::= any one of the ten digits 0 through 9
本文档引用http://tools.ietf.org/html/rfc1738#section-3.1来描述主机命名规则。