根据 RFC1035,dns 名称可能包含 \ddd \x 和引号。请举例说明这些。
2 回答
RFC1035没有说 DNS名称可以包含这些字符。在第 5 节(主文件)中,它说包含 RR 信息的文件可以包含这些字符。具体来说:“因为这些文件是文本文件,所以需要几种特殊编码才能加载任意数据。” 除了域之外,还有可以进入区域文件的文本。例如,TXT 记录中的条目是自由文本,因此您可能希望在其中放入一个二进制字符,用 \ddd 字符串等表示。您还可以发表评论,因此您可以使用这些“特殊编码” “在你的评论中。
支持国际化域名,但 RFC1035 是从 1987 年开始的,当时还没有讨论 i18n 域名。
编辑:我只是重读它,我认为我错了。上面的内容在技术上是关于文件格式的。但是,这也在 RFC 的 3.1 节中:
Although labels can contain any 8 bit values in octets that make up a label, it is strongly recommended that labels follow the preferred syntax described elsewhere in this memo, which is compatible with existing host naming conventions. Name servers and resolvers must compare labels in a case-insensitive manner (i.e., A=a), assuming ASCII with zero parity. Non-alphabetic codes must match exactly.
因此,这表示任何 8 位字符都可以成为标签的一部分(其中标签是点之间的域名部分)。不过,该文档描述的是 DNS 协议的技术能力。常见用法是另一回事。实际上,在“2.3.1.首选名称语法”部分中:
The following syntax will result in
fewer problems with many applications
that use domain names (e.g., mail,
TELNET).
<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
换句话说,DNS 协议从一开始就被定义为使用 8 位 ascii。但是,如果您真的希望您的程序能够使用 DNS 中的域,您应该坚持使用 [az-]。
举个例子,我认为这只是意味着你可以有一个这样的 DNS 条目:
IHaveAn\020EmbeddedTab IN A 172.24.3.1
推荐阅读RFC 2181,其第 11 节很好地解释了这个问题。
否则,例如,请参阅maps-to-nonascii.rfc-test.net
。此名称是具有非 ASCII 字符的名称的别名。