/
309.txt
285 lines (214 loc) · 11.6 KB
/
309.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
[1] [DFN[LDH [RUBYB[ラベル]@en[label]]]]は、 [[DNS]] において、 [[letter]]、
[[数字]]、[[ハイフン]]で構成される[[ラベル]]のことを言います [WEAK[(より厳密には >>8)]]。
元々は単に「[[ラベル]]」とも呼ばれていましたが、 [[IDN]]
における[[ラベル]]は[[非ASCII文字]]に拡張されているため、 [[IDNA2008]] では
「[[LDHラベル]]」という語を導入しています。
[3] これは元をたどれば [[RFC 952]] で「[DFN[[RUBYB[[[ホスト名]]]@en[hostname]]]]」
と言っていたものに近いです [SRC[>>2]] が、若干の違いがあります (>>14)。
あるいは [[RFC 1034]] の3.5節で「[DFN[[RUBYB[好ましい名前の構文]@en[preferred name syntax]]]]」
と言われていたものを [[RFC 1123]] で変更したものと構文的に同じです [SRC[>>2]]。
* 仕様書
[REFS[
- [14] [CITE@en[RFC 952 - DoD Internet host table specification]]
<http://tools.ietf.org/html/rfc952>
- [13] [[RFC 1034]] <http://tools.ietf.org/html/rfc1034#section-3.5>
- [15] [CITE@en[RFC 1123 - Requirements for Internet Hosts - Application and Support]]
<http://tools.ietf.org/html/rfc1123#section-2>
@@ [[STD 13]], [[STD 3]]
- [2] [[IDNA 2008]] [CITE@en[RFC 5890 - Internationalized Domain Names for Applications (IDNA): Definitions and Document Framework]]
<http://tools.ietf.org/html/rfc5890#section-2.3.1>
]REFS]
* 構文
[8] [[LDHラベル]]とは、
[FIG[
- [5] [[ASCII]] の [[letter]]、[[数字]]、[[ハイフン]]で構成される[[文字列]]であること
- [6] 最初と最後が[[ハイフン]]ではないこと
- [7] 63[[オクテット]]を超えないこと
]FIG]
... という条件を満たすもの ([[DNSラベル]]) です。 [SRC[>>2]]
[FIG(railroad)[
= |
== [CODE[[[ALPHA]]]]
== [CODE[[[DIGIT]]]]
= ?
== *
=== |
==== [CODE[[[ALPHA]]]]
==== [CODE[[[DIGIT]]]]
==== [CODE[[[-]]]]
== |
=== [CODE[[[ALPHA]]]]
=== [CODE[[[DIGIT]]]]
]FIG]
** 「-」
[21] [[LDHラベル]]は、定義上「[CODE(char)[[[-]]]]」から始めたり終わったりすることができません。
しかし、現実にはそのような[[ラベル]]を使った[[ドメイン名]]が存在します。
[22] [CITE[Bug 196852 – URLs starting with hyphen ( - ) not resolved]] ([TIME[2008-06-27 00:33:45 +09:00]] 版) <https://bugzilla.mozilla.org/show_bug.cgi?id=196852>
[23] >>22 によれば、 [[Windows]] の [[resolver]] はこれに対応しているものの、
[[Linux]] の [[resolver]] は対応していないようです。
** 「_」
[26] [[LDHラベル]]は、定義上「[CODE(char)[[[_]]]]」を含めることができません。
しかし、現実にはそのような[[ラベル]]を使った[[ドメイン名]]が存在します。
;; [27] [[DNS]] 的には「[CODE(char)[[[_]]]]」は[[下線ラベル]]という別の概念に使われています。
[25] ホスト名に [CODE[_]] を含める困った無料鯖, [[Tripod]] 以外にもあるらしい。
[24] >>1 このままなし崩し的に [CODE[_]] も名前文字に仲間入りするのかなあ?
[32] [[Webブラウザー]]によっては [CODE[[[_]]]] が含まれる[[ドメイン]]で
[[Cookie]] を正しく扱えないようです。
[28] [CODE(char)[[[_]]]] は「好ましい」構文には含まれていませんが、 [[DNS]]
仕様上特に禁じられているわけではありません。
[29] [[RFC 3986]] は [[URI]] の [[host]] として使える名前を特に [[DNS]]
に限定しておらず、構文上 [CODE[[[_]]]] やその他の記号を禁じていません。
[30] [[RFC 2616]] は旧仕様である [[RFC 2396]] を参照しており、
[CODE(URI)@en[[[http:]]]] [[URL]] の [[host]] 部分や [CODE(HTTP)@en[[[Host:]]]]
[[頭欄]]の値として [[RFC 2396]] の [[host]]、すなわち「好ましい」構文による [[DNS]]
名を求めているため、 [CODE[[[_]]]] は禁止されています。
[31] [[RFC 6265]] は [CODE(HTTP)@en[[[Set-Cookie:]]]] [[頭欄]]の [CODE(HTTP)@en[[[Domain]]]]
[[属性]]が従わなければならない構文として「好ましい」構文を使っているため、
[CODE[[[_]]]] は禁止されています。しかし解釈する側においては、仕様書の解釈しだいでは
[CODE[[[_]]]] を受け入れることも禁止されていないと読めます。
** 非ASCII文字
[33] [[IDN]] を参照。
* 分類
- [17] [[R-LDHラベル]]
- [18] [[NR-LDHラベル]]
[19] [[IDNA]] で正しいとされるのは [[NR-LDHラベル]]と、 [[R-LDHラベル]]のうち [[Aラベル]]だけです。
[WEAK[(他に [[Uラベル]]もありますが、 [[Uラベル]]は [[LDHラベル]]ではありません。)]]
[[XNラベル]]ではない[[R-LDHラベル]]や[[偽Aラベル]]は正しくない[[ラベル]]ということになります。
* 特別なホスト名
[42]
[FIG(short list)[
- [CODE[www.]]
]FIG]
* 歴史
[12] 以前は先頭1文字が [CODE(ABNF)@en[[[DIGIT]]]] であることも認められていませんでしたが、
[[RFC 1123]] で緩和されています。
** RFC 952 より
[10] [SRC[>>14]]
>
1. A "name" (Net, Host, Gateway, or Domain name) is a text string up
to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus
sign (-), and period (.). Note that periods are only allowed when
they serve to delimit components of "domain style names". (See
RFC-921, "Domain Name System Implementation Schedule", for
background). No blank or space characters are permitted as part of a
name. No distinction is made between upper and lower case. The first
character must be an alpha character. The last character must not be
a minus sign or period. A host which serves as a GATEWAY should have
"-GATEWAY" or "-GW" as part of its name. Hosts which do not serve as
Internet gateways should not use "-GATEWAY" and "-GW" as part of
their names. A host which is a TAC should have "-TAC" as the last
part of its host name, if it is a DoD host. Single character names
or nicknames are not allowed.
>
[PRE(ABNF code)[
<hname> ::= <name>*["."<name>]
<name> ::= <let>[*[<let-or-digit-or-hyphen>]<let-or-digit>]
]PRE]
** RFC 1034 より
[16] [SRC[>>13]]
>
[PRE(BNF)[
<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
]PRE]
** RFC 1123 より
[9] [SRC[>>15]]
> The syntax of a legal Internet host name was specified in RFC-952 [DNS:4].
One aspect of host name syntax is hereby changed: the
restriction on the first character is relaxed to allow either a
letter or a digit. Host software MUST support this more liberal syntax.
> Host software MUST handle host names of up to 63 characters and
SHOULD handle host names of up to 255 characters.
* 関連
[20] [[LDHラベル]]でない[[ASCIIラベル]]を[[非LDHラベル]]といいます。
[FIG(quote)[
[FIGCAPTION[
[4] [CITE@en[RFC 4519 - Lightweight Directory Access Protocol (LDAP): Schema for User Applications]]
([TIME[2015-01-04 15:23:19 +09:00]] 版)
<http://tools.ietf.org/html/rfc4519#section-2.4>
]FIGCAPTION]
>
> label = (ALPHA / DIGIT) '''['''*61(ALPHA / DIGIT / HYPHEN) (ALPHA / DIGIT)''']'''
> ALPHA = %x41-5A / %x61-7A ; "A"-"Z" / "a"-"z"
> DIGIT = %x30-39 ; "0"-"9"
> HYPHEN = %x2D ; hyphen ("-")
]FIG]
[FIG(quote)[
[FIGCAPTION[
[11] [CITE@en[RFC 6055 - IAB Thoughts on Encodings for Internationalized Domain Names]]
([TIME[2015-04-26 07:31:45 +09:00]] 版)
<https://tools.ietf.org/html/rfc6055#section-3>
]FIGCAPTION]
> The confusion was thus left as to whether the "preferred" name syntax
> was a mandatory restriction in DNS, or merely "preferred".
>
]FIG]
[FIG(quote)[
[FIGCAPTION[
[34] [CITE@en[RFC 5731 - Extensible Provisioning Protocol (EPP) Domain Name Mapping]]
([TIME[2015-03-22 17:40:40 +09:00]] 版)
<https://tools.ietf.org/html/rfc5731#section-2.1>
]FIGCAPTION]
> The syntax for domain and host names described in this document MUST
> conform to '''['''RFC0952''']''' and '''['''RFC1123''']'''. At the time of this writing, RFC
> 3490 '''['''RFC3490''']''' describes a standard to use certain ASCII name labels
> to represent non-ASCII name labels.
]FIG]
[35] [CITE[IRC logs: freenode / #whatwg / 20150715]]
([TIME[2015-07-16 10:57:28 +09:00]] 版)
<http://krijnhoetmer.nl/irc-logs/whatwg/20150715>
[36] [CITE@en[Define host equivalence but punt on requirements coming from the cert… · whatwg/url@5e903fe]]
([TIME[2015-08-20 13:13:42 +09:00]] 版)
<https://github.com/whatwg/url/commit/5e903fee4b9a893c8236cf292a0d56a7254ee823>
[37] [CITE@en[Remove URL.domainToASCII and URL.domainToUnicode · Issue #63 · whatwg/url]]
([TIME[2015-08-20 13:16:12 +09:00]] 版)
<https://github.com/whatwg/url/issues/63>
[38] [CITE@en[317946 – Hostnames containing + (plus) do not work in 1.5 (did work in 1.0 and even in IE)]]
([TIME[2015-09-21 21:44:40 +09:00]] 版)
<https://bugzilla.mozilla.org/show_bug.cgi?id=317946>
[39] [CITE@en[355181 – net_IsValidHostName() comment says one thing, code does another]]
([TIME[2015-09-21 21:45:15 +09:00]] 版)
<https://bugzilla.mozilla.org/show_bug.cgi?id=355181>
[40] [CITE@ja[部屋さがしだけではとどまらぬ。おんなのこ×賃貸物件【Concent不動産】]]
([TIME[2015-11-10 16:44:46 +09:00]] 版)
<http://concent--e.jp/>
[FIG(quote)[
[FIGCAPTION[
[41] [CITE@en[RFC 7719 - DNS Terminology]]
( ([TIME[2016-06-05 17:09:11 +09:00]]))
<https://tools.ietf.org/html/rfc7719#section-2>
]FIGCAPTION]
> Host name: This term and its equivalent, "hostname", have been
> widely used but are not defined in '''['''RFC1034''']''', '''['''RFC1035''']''',
> '''['''RFC1123''']''', or '''['''RFC2181''']'''. The DNS was originally deployed into the
> Host Tables environment as outlined in '''['''RFC952''']''', and it is likely
> that the term followed informally from the definition there. Over
> time, the definition seems to have shifted. "Host name" is often
> meant to be a domain name that follows the rules in Section 3.5 of
> '''['''RFC1034''']''', the "preferred name syntax". Note that any label in a
> domain name can contain any octet value; hostnames are generally
> considered to be domain names where every label follows the rules
> in the "preferred name syntax", with the amendment that labels can
> start with ASCII digits (this amendment comes from Section 2.1 of
> '''['''RFC1123''']''').
> People also sometimes use the term hostname to refer to just the
> first label of an FQDN, such as "printer" in
> "printer.admin.example.com". (Sometimes this is formalized in
> Hoffman, et al. Informational '''['''Page 4''']'''
> page-5
> RFC 7719 DNS Terminology December 2015
> configuration in operating systems.) In addition, people
> sometimes use this term to describe any name that refers to a
> machine, and those might include labels that do not conform to the
> "preferred name syntax".
]FIG]
[43] [CITE@ja[名古屋のデザイナーズマンション・高級賃貸なら【スタイルプラス】]]
( ([TIME[2016-11-18 01:02:45 +09:00]]))
<http://www.style--plus.jp/>