目標
URL 標準は、 次に挙げるアプローチにより,URL を全部的に相互運用可能にすることを目指す: The URL standard takes the following approach towards making URLs fully interoperable:
- [ [RFC3986], [RFC3987] ]を現今の実装に揃わせて、 その過程の中でそれらの RFC を過去のものにする (例えば,[ 空白, 他の “合法でない” 符号位置, クエリの符号化法, 同等性, 正準化 ]などの概念は、 どれも完全には共有もしくは定義されていない)。 URL の構文解析法は、 HTML の構文解析法と同程度に確固たるものになる必要がある。 Align RFC 3986 and RFC 3987 with contemporary implementations and obsolete the RFCs in the process. (E.g., spaces, other "illegal" code points, query encoding, equality, canonicalization, are all concepts not entirely shared, or defined.) URL parsing needs to become as solid as HTML parsing. [RFC3986] [RFC3987]
- 語 URL を標準化する。 URI と IRI は混同され易い。 実施においては,どちらにも同じアルゴリズムが利用されるので、 それらを区別する利点は無い。 Web の検索結果でも, URL の方が優位にある。 Standardize on the term URL. URI and IRI are just confusing. In practice a single algorithm is used for both so keeping them distinct is not helping anyone. URL also easily wins the search result popularity contest.
- URI [sic] の生成元 [RFC6454] に取って代わる。 Supplanting Origin of a URI [sic]. [RFC6454]
-
URL の既存の JavaScript API における全部的な詳細を定義して,
より作業し易くするための増補を追加する。
また、
HTML 要素を通さない URL 操作用に,
URL
オブジェクトを新たに追加する (JavaScript worker 環境用に有用になる)。 Define URL’s existing JavaScript API in full detail and add enhancements to make it easier to work with. Add a new URL object as well for URL manipulation without usage of HTML elements. (Useful for JavaScript worker environments.) - [ 構文解析器, 直列化器, API ]の組み合せにおける冪等性を保証する。 例えば、 構文解析してから直列化する演算を重ねて適用しても, 1 回だけ適用した結果(失敗でないとする)と同じになること。 同様に、 API を通して操作した結果(失敗でないとする)に対し, それを直列化してから構文解析した結果は、 何回適用しようが同じになること。 Ensure the combination of parser, serializer, and API guarantee idempotence. For example, a non-failure result of a parse-then-serialize operation will not change with any further parse-then-serialize operations applied to it. Similarly, manipulating a non-failure result through the API will not change from applying any number of serialize-then-parse operations to it.
注記: 編集者たちがこの主題に関しより多くを学ぶに連れ、 目標となる視野は拡がるかもしれない。 As the editors learn more about the subject matter the goals might increase in scope somewhat.
【この訳に特有な表記規約】
この訳において(主にアルゴリズム内で)利用される各種記号( ε, ← , IF, THROW, 等々)の意味や定義の詳細は、共通な慣用表現, アルゴリズムに共通して利用される表記を参照されたし。
加えて、 次の記法も利用する :s << a << b << … :これは、 左辺の[ 文字列/バイト列 ] s の末尾に後続の[ 文字列/バイト列 ] a, b, … を示された順に付加する演算を表す。 式として用いられた場合、 結果の s が式の値になる。
1. 基盤
この仕様は Infra [INFRA] に依存する。 This specification depends on Infra. [INFRA]
この仕様に利用される一部の用語は、 次に挙げる[ 標準/仕様 ]にて定義される :Encoding [ENCODING], File API [FILEAPI], HTML [HTML], Unicode IDNA Compatibility Processing [UTS46], Web IDL [WEBIDL] Some terms used in this specification are defined in the following standards and specifications: • Encoding [ENCODING] • File API [FILEAPI] • HTML [HTML] • Unicode IDNA Compatibility Processing [UTS46] • Web IDL [WEBIDL]
整数を直列化する アルゴリズムは、 所与の ( 整数 N ) に対し :RETURN N を 10 進数で最短に表現する文字列 【結果には、 ASCII 数字に加え,負符号も含まれ得るが、この仕様では,負符号は生じ得ない。】 To serialize an integer, represent it as the shortest possible decimal number.
1.1. 書式
検証エラー とは、 入力と妥当な入力との間の不一致を指示するものである。 UA — とりわけ,適合性検査器 — には、 どこかへそれを報告することが奨励される。 A validation error indicates a mismatch between input and valid input. User agents, especially conformance checkers, are encouraged to report them somewhere.
注記: 検証エラーは、 構文解析器を終了させるものではない。 構文解析器の終了は、 常に,明示的にそう記される — RETURN 文などにより。 A validation error does not mean that the parser terminates. Termination of a parser is always stated explicitly, e.g., through a return statement.
検証エラーを通達することは、 有用になる — エラーの取り扱いは直感的でないこともあり、[ 旧来の UA は、 正しいエラーの取り扱いを実装していないかもしれない/ 他の開発者にとっては、 何を意図して書き出されたか明瞭でないかもしれない ]ので。 It is useful to signal validation errors as error-handling can be non-intuitive, legacy user agents might not implement correct error-handling, and the intent of what is written might be unclear to other developers.
エラーの種別 Error type | エラーの記述 Error description | 例 | 失敗か? Failure |
---|---|---|---|
§ IDNA IDNA | |||
domain-to-ASCII |
Unicode ToASCII [UTS46] が, エラーを記録したか空文字列を返した。 Unicode ToASCII records an error or returns the empty string. [UTS46] 注記: Unicode ToASCII におけるエラーについての詳細が記録された場合、 UA には,それも渡すことが奨励される。 If details about Unicode ToASCII errors are recorded, user agents are encouraged to pass those along. | 失敗する Yes | |
domain-invalid-code-point | 入力のホストが,禁止ドメイン符号位置を包含している。 The input’s host contains a forbidden domain code point. |
URL が特別であるとき、
そのホストが,処理される前に %-復号された
— URL が "https://exa%23mple.org " であったなら、
その結果,ホスト部位は "exa#mple.org " になり、
このエラーを誘発する。
Hosts are percent-decoded before being processed when the URL is special, which would result in the following host portion becoming "exa#mple.org" and thus triggering this error."https://exa%23mple.org" | 失敗する Yes |
domain-to-Unicode |
Unicode ToUnicode [UTS46] が, エラーを記録した。 Unicode ToUnicode records an error. [UTS46] 注記: domain-to-ASCII と同じ考慮点が適用される。 The same considerations as with domain-to-ASCII apply. | · | |
§ ホストの構文解析法 Host parsing | |||
host-invalid-code-point | 不透明なホスト(特別でない URL )が,禁止ホスト符号位置を包含している。 An opaque host (in a URL that is not special) contains a forbidden host code point. |
"foo://exa[mple.org "
| 失敗する Yes |
IPv4-empty-part | IPv4 アドレスが, U+002E (.) で終端している。 An IPv4 address ends with a U+002E (.). |
"https://127.0.0.1./ "
| · |
IPv4-too-many-parts | IPv4 アドレスを成す成分の個数が, 4 でない。 An IPv4 address does not consist of exactly 4 parts. |
"https://1.2.3.4.5/ "
| 失敗する Yes |
IPv4-non-numeric-part | IPv4 アドレスを成すある成分が, 数でない。 An IPv4 address part is not numeric. |
"https://test.42 "
| 失敗する Yes |
IPv4-non-decimal-part | IPv4 アドレスを成すある成分が,[ 16 進/8 進 ]数字を利用して表出された番号である。 The IPv4 address contains numbers expressed using hexadecimal or octal digits. |
"https://127.0.0x0.1 "
| · |
IPv4-out-of-range-part | IPv4 アドレスを成すある成分が, 255 を超過している。 An IPv4 address part exceeds 255. |
"https://255.255.4000.1 "
| 失敗する (最後の成分に適用可能な場合に限り) Yes (only if applicable to the last part) |
IPv6-unclosed | IPv6 アドレスを閉じる U+005D (]) が欠落している。 An IPv6 address is missing the closing U+005D (]). |
"https://[::1 "
| 失敗する Yes |
IPv6-invalid-compression | IPv6 アドレスが, 不適正な圧縮から始まっている。 An IPv6 address begins with improper compression. |
"https://[:1] "
| 失敗する Yes |
IPv6-too-many-pieces | IPv6 アドレスが包含する piece の個数が, 8 以下でない。 An IPv6 address contains more than 8 pieces. |
"https://[1:2:3:4:5:6:7:8:9] "
| 失敗する Yes |
IPv6-multiple-compression | IPv6 アドレスが, 2 箇所以上で圧縮されている。 An IPv6 address is compressed in more than one spot. |
"https://[1::1::1] "
| 失敗する Yes |
IPv6-invalid-code-point | IPv6 アドレスが,[ ASCII 16 進数字, U+003A (:) ]以外の符号位置を包含しているか, 期待されない所で終端している。 An IPv6 address contains a code point that is neither an ASCII hex digit nor a U+003A (:). Or it unexpectedly ends. |
"
" | 失敗する Yes |
IPv6-too-few-pieces | 圧縮済みでない IPv6 アドレスを成す piece の個数が, 8 個に満たない。 An uncompressed IPv6 address contains fewer than 8 pieces. |
"https://[1:2:3] "
| 失敗する Yes |
IPv4-in-IPv6-too-many-pieces | IPv4 アドレス構文を伴う IPv6 アドレスにおいて、 IPv6 アドレスを成す piece の個数が, 6 以下でない。 An IPv6 address with IPv4 address syntax: the IPv6 address has more than 6 pieces. |
"https://[1:1:1:1:1:1:1:127.0.0.1] "
| 失敗する Yes |
IPv4-in-IPv6-invalid-code-point |
IPv4 アドレス構文を伴う IPv6 アドレスにおいて: An IPv6 address with IPv4 address syntax:
|
"
"
"
"
" | 失敗する Yes |
IPv4-in-IPv6-out-of-range-part | IPv4 アドレス構文を伴う IPv6 アドレスにおいて、 ある IPv4 成分が, 255 を超過している。 An IPv6 address with IPv4 address syntax: an IPv4 part exceeds 255. |
"https://[ffff::127.0.0.4000] "
| 失敗する Yes |
IPv4-in-IPv6-too-few-parts | IPv4 アドレス構文を伴う IPv6 アドレスにおいて、 IPv4 成分の個数が, 少な過ぎる。 An IPv6 address with IPv4 address syntax: an IPv4 address contains too few parts. |
"https://[ffff::127.0.0] "
| 失敗する Yes |
§ URL の構文解析法 URL parsing | |||
invalid-URL-unit | URL 単位でない符号位置が見出された。 A code point is found that is not a URL unit. |
"
"
"
" | · |
special-scheme-missing-following-solidus |
入力のスキームに "// " が後続していない。
The input’s scheme is not followed by "//". |
"
" const url = new URL("https:foo.html", "https://example.org/"); | · |
missing-scheme-non-relative-URL | 入力のスキームが欠落している — [ 入力は ASCII 英字で始まっていない ]かつ[ 基底 URL は供されていないか, 供されたが不透明なパスを有するので基底 URL として利用できない ]ことにより。 The input is missing a scheme, because it does not begin with an ASCII alpha, and either no base URL was provided or the base URL cannot be used as a base URL because it has an opaque path. |
入力のスキームが欠落していて,基底 URL は与えられていない: Input’s scheme is missing and no base URL is given: const url = new URL("💩"); 入力のスキームが欠落していて, 基底 URL は不透明なパスを有する: Input’s scheme is missing, but the base URL has an opaque path. const url = new URL("💩", "mailto:user@example.org"); | 失敗する Yes |
invalid-reverse-solidus | URL は、 特別スキームを伴うが, U+002F (/) の代わりに U+005C (\) を利用している。 The URL has a special scheme and it uses U+005C (\) instead of U+002F (/). |
"https://example.org\path\to\file "
| · |
invalid-credentials | 入力は,資格情報を含んでいる。 The input includes credentials. |
"
" | · |
host-missing | 入力は、 特別スキームを伴うが,ホストを包含していない。 The input has a special scheme, but does not contain a host. |
"
"
" | 失敗する Yes |
port-out-of-range | 入力のポートが, 大き過ぎる。 The input’s port is too big. |
"https://example.org:70000 "
| 失敗する Yes |
port-invalid | 入力のポートが, 妥当でない。 The input’s port is invalid. |
"https://example.org:7z "
| 失敗する Yes |
file-invalid-Windows-drive-letter |
入力は Windows ドライブレターから開始している相対 URL 文字列であるが、
基底 URL のスキームは " |
const url = new URL("/c:/path/to/file", "file:///c:/"); | · |
file-invalid-Windows-drive-letter-host |
file: URL のホストが,
Windows ドライブレターである。
A file: URL’s host is a Windows drive letter. |
"file://c: "
| · |
1.2. 構文解析器
EOF とは、[ 文字列ストリーム / 符号位置ストリーム ]の終端を表す,概念的な符号位置である†。 The EOF code point is a conceptual code point that signifies the end of a string or code point stream.
【 “End Of File” の略称 — この訳では、 原文の “EOF 符号位置” を単に “EOF” と略記する。 】【† したがって、 どの本物の符号位置とも等しくない。 】
所与の文字列 入力 用の ポインタ は、 入力 の中の ある符号位置を指す整数であり,初期時には 入力 の先頭を指す【値としては 0 】とする。 それは、 −1 ならば ε を指す( “どこも指さない” )/ 入力 の符号位置長さ以上ならば EOF を指す【 入力 が空ならば、常にそうなる】。 A pointer for a string input is an integer that points to a code point within input. Initially it points to the start of input. If it is −1 it points nowhere. If it is greater than or equal to input’s code point length, it points to the EOF code point.
ポインタが利用されている下での記号 C, C1, C2 は、 順に[ ポインタが指している符号位置, その次の符号位置, 次の次の符号位置 ]を参照する。 ポインタが ε を指している場合、 これらの記号は利用され得ない。 ポインタが EOF を指している場合, C は EOF になり、 C1, C2 についても同様とする。 When a pointer is used, c references the code point the pointer points to as long as it does not point nowhere. When the pointer points to nowhere c cannot be used.When a pointer is used, remaining references the code point substring from the pointer + 1 to the end of the string, as long as c is not the EOF code point. When c is the EOF code point remaining cannot be used.
例えば、
処理される文字列が "http://example.com
" で,
ポインタが "o
" を指しているなら、[
C, C1, C2
]は,順に[
U+006F (o), U+006D (m), EOF
]になる。
If "mailto:username@example" is a string being processed and a pointer points to @, c is U+0040 (@) and remaining is "example".
例えば、 ポインタは文字列の先頭を指している下で, 1 減らしてから C (あるいは C1, C2 )を利用するのは【仕様における】エラーである。 If the empty string is being processed and a pointer points to the start and is then decreased by 1, using c or remaining would be an error.
【 C1, C2 は、 原文の remaining に代えて,この訳に導入した記号である — remaining は[ ポインタ + 1 から終端までを成す符号位置部分文字列 ]( C1 以降を成す部分文字列)として定義されているが、 それを利用しているどの箇所も,実際には C1, C2 しか利用していないので。 】【 C は,原文では小文字 “c” であるが、 日本語の字の大きさとの兼ね合いにより,この訳では大文字で記すことにする。 】
1.3. %-符号化されたバイト
【
“ %-” は、
原文の接頭語 “percent-” の(この訳による)略記であり,文字 "%
" に関わることを表す。
】
%-符号化されたバイト とは、[ U+0025 (%), ASCII 16 進数字, ASCII 16 進数字 ]の並びが成す文字列である。 A percent-encoded byte is U+0025 (%), followed by two ASCII hex digits.
注記: 一般に, %-符号化されたバイトたちが成す連列用には、[ 文字列をバイト列に %-復号する, BOM も失敗もそのままに UTF-8 復号する ]を順に適用したときの結果が 失敗 にならないようにすることが,良い案になる。 これがどう重要になるかは、 %-符号化されたバイトがどこで利用されるかに依存する。 例: ホスト構文解析器用には,この助言に従わないことは致命的である一方、 URL の具現化用には, %-符号化されたバイトを %-復号しないで具現化することになろう。 It is generally a good idea for sequences of percent-encoded bytes to be such that, when percent-decoded and then passed to UTF-8 decode without BOM or fail, they do not end up as failure. How important this is depends on where the percent-encoded bytes are used. E.g., for the host parser not following this advice is fatal, whereas for URL rendering the percent-encoded bytes would not be rendered percent-decoded.
バイトを文字列に %-符号化する アルゴリズムは、 所与の ( 1 個のバイト バイト ) に対し :RETURN 次に与える %-符号化されたバイト :U+0025 (%) << [ バイト を表現する 2 個の ASCII 16 進数字(大文字) ] To percent-encode a byte byte, return a string consisting of U+0025 (%), followed by two ASCII upper hex digits representing byte.
バイト列をバイト列に %-復号する アルゴリズムは、 所与の ( バイト列 入力 ) に対し: To percent-decode a byte sequence input, run these steps:
警告: 入力 が ASCII バイト以外のバイトを含み得るときに, BOM はそのままに UTF-8 復号する以外を利用するのは、 セキュアでないこともあるので推奨されない。 Using anything but UTF-8 decode without BOM when input contains bytes that are not ASCII bytes might be insecure and is not recommended.
- 出力 :← 空バイト列 Let output be an empty byte sequence.
- L :← 入力 の長さ ↓
- N :← 1 ↓
-
WHILE[ N ≤ L ]:
- バイト :← 入力 の N 個目のバイト
- N += 1
-
IF[ バイト = 0x25 (%) ]∧[ N + 1 ≤ L ]:
- バイト列 :← 入力 の[ N 個目, N + 1 個目 ]のバイトが成すバイト列
-
IF[ バイト列 を成すどのバイト b も[ b ∈ { 0x30 (0) 〜 0x39 (9), 0x41 (A) 〜 0x46 (F), 0x61 (a) 〜 0x66 (f) } ]を満たす ]:
- 16 進文字列 :← 同型に復号する( バイト列 )
- バイト ← [ 16 進文字列 を 16 進数として解釈した結果の数 ]を値とするバイト
- N += 2
- 出力 << バイト
- RETURN 出力 Return output.
文字列をバイト列に %-復号する アルゴリズムは、 所与の ( スカラー値文字列 入力 ) に対し :RETURN バイト列をバイト列に %-復号する( UTF-8 符号化する( 入力 ) ) To percent-decode a scalar value string input: • Let bytes be the UTF-8 encoding of input. • Return the percent-decoding of bytes.
注記: 一般に、 %-符号化した結果の文字列を成す U+0025 (%) 符号位置は,入力より増え、 %-復号した結果のバイト列を成す 0x25 (%) バイトは,入力より減る。 In general, percent-encoding results in a string with more U+0025 (%) code points than the input, and percent-decoding results in a byte sequence with less 0x25 (%) bytes than the input.
【 次に挙げる各種[ 符号位置たちが成す集合 ]は、 後続の各種 “ %-符号化する” アルゴリズムから利用される: 】
- C0 制御文字 %-符号化集合 は、 次に挙げる符号位置が成す集合である :C0 制御文字, U+007F DELETE 〜 U+10FFFF The C0 control percent-encode set are the C0 controls and all code points greater than U+007E (~).
- 素片 %-符号化集合 は、 次に挙げる符号位置が成す集合である :C0 制御文字 %-符号化集合, U+0020 SPACE, U+0022 ("), U+003C (<), U+003E (>), U+0060 (`) The fragment percent-encode set is the C0 control percent-encode set and U+0020 SPACE, U+0022 ("), U+003C (<), U+003E (>), and U+0060 (`).
-
クエリ %-符号化集合 は、 次に挙げる符号位置が成す集合である :C0 制御文字 %-符号化集合, U+0020 SPACE, U+0022 ("), U+0023 (#), U+003C (<), U+003E (>), The query percent-encode set is the C0 control percent-encode set and U+0020 SPACE, U+0022 ("), U+0023 (#), U+003C (<), and U+003E (>).
注記: クエリ %-符号化集合は、 U+0060 (`) を含まないので,素片 %-符号化集合を含むように定義し得ない。 The query percent-encode set cannot be defined in terms of the fragment percent-encode set due to the omission of U+0060 (`).
- 特別クエリ %-符号化集合 は、 次に挙げる符号位置が成す集合である :クエリ %-符号化集合, U+0027 (') The special-query percent-encode set is the query percent-encode set and U+0027 (').
- パス %-符号化集合 は、 次に挙げる符号位置が成す集合である :クエリ %-符号化集合, U+003F (?), U+005E (^), U+0060 (`), U+007B ({), U+007D (}) The path percent-encode set is the query percent-encode set and U+003F (?), U+005E (^), U+0060 (`), U+007B ({), and U+007D (}).
- ユーザ情報 %-符号化集合 は、 次に挙げる符号位置が成す集合である :パス %-符号化集合, U+002F (/), U+003A (:), U+003B (;), U+003D (=), U+0040 (@), U+005B ([), U+005C (\), U+005D (]), U+007C (|) The userinfo percent-encode set is the path percent-encode set and U+002F (/), U+003A (:), U+003B (;), U+003D (=), U+0040 (@), U+005B ([) to U+005D (]), inclusive, and U+007C (|).
-
成分 %-符号化集合 は、 次に挙げる符号位置が成す集合である :ユーザ情報 %-符号化集合 U+0024 ($), U+0025 (%), U+0026 (&), U+002B (+), U+002C (,) The component percent-encode set is the userinfo percent-encode set and U+0024 ($) to U+0026 (&), inclusive, U+002B (+), and U+002C (,).
注記: これは、 HTML において
registerProtocolHandler()
用に利用される。 また,他の標準も、 後で[ URL の[ パス/クエリ/素片 ]内 / 不透明なホスト内 ]に埋め込めるよう,データを %-符号化するときに利用できる。 文字列を UTF-8 %-符号化するときに これを利用すると、 JavaScript のencodeURIComponent()
[sic]† に一致する結果が得られる。 [HTML] [ECMA-262] 【† “ "URI" は誤字ではない” 】 This is used by HTML for registerProtocolHandler(), and could also be used by other standards to percent-encode data that can then be embedded in a URL’s path, query, or fragment; or in an opaque host. Using it with UTF-8 percent-encode gives identical results to JavaScript’s encodeURIComponent() [sic]. [HTML] [ECMA-262] -
application/x-www-form-urlencoded
%-符号化集合 は、 次に挙げる符号位置が成す集合である :成分 %-符号化集合, U+0021 (!), U+0027 ('), U+0028 ((), U+0029 ()), U+007E (~) The application/x-www-form-urlencoded percent-encode set is the component percent-encode set and U+0021 (!), U+0027 (') to U+0029 RIGHT PARENTHESIS, inclusive, and U+007E (~).注記:
application/x-www-form-urlencoded
%-符号化集合は、 次に挙げるもの以外の すべての符号位置を包含する :ASCII 英数字, U+002A (*), U+002D (-), U+002E (.), U+005F (_) The application/x-www-form-urlencoded percent-encode set contains all code points, except the ASCII alphanumeric, U+002A (*), U+002D (-), U+002E (.), and U+005F (_).
文字列を符号化してから %-符号化する アルゴリズムは、 所与の ( 符号化法 符号化法, スカラー値文字列 入力, 符号位置たちが成す集合 %-符号化集合, 真偽値 spaceAsPlus (省略時は false ) ) に対し: To percent-encode after encoding, given an encoding encoding, scalar value string input, a percentEncodeSet, and an optional boolean spaceAsPlus (default false):
- 符号化器 :← 符号化器を取得する( 符号化法 ) Let encoder be the result of getting an encoder from encoding.
- 入力キュー :← 入力 を入出力キューに変換した結果 Let inputQueue be input converted to an I/O queue.
- 出力 :← 空文字列 Let output be the empty string.
-
WHILE 無条件: Let potentialError be 0.This needs to be a non-null value to initiate the subsequent while loop.While potentialError is non-null:↓↓
- 符号化出力 :← 空な入出力キュー Let encodeOutput be an empty I/O queue.
- エラーになり得る :← 符号化するか失敗する( 入力キュー, 符号化器, 符号化出力 ) Set potentialError to the result of running encode or fail with inputQueue, encoder, and encodeOutput.
-
[ 符号化出力 をバイト列に変換した結果 ]を成す 各( バイト ) に対し: For each byte of encodeOutput converted to a byte sequence:
- IF[ spaceAsPlus = true ]∧[ バイト = 0x20 (SP) ] :出力 << U+002B (+); CONTINUE If spaceAsPlus is true and byte is 0x20 (SP), then append U+002B (+) to output and continue.
- 同型な符号位置 :← 次を満たす符号位置 :その値 = バイト の値 Let isomorph be a code point whose value is byte’s value.
- Assert: %-符号化集合 は ASCII 符号位置でないすべての符号位置を含む。 Assert: percentEncodeSet includes all non-ASCII code points.
- IF[ 同型な符号位置 ∉ %-符号化集合 ] :出力 << 同型な符号位置 If isomorph is not in percentEncodeSet, then append isomorph to output.
- ELSE :出力 << バイトを文字列に %-符号化する( バイト ) Otherwise, percent-encode byte and append the result to output.
-
IF[ エラーになり得る ≠ null ] :出力 << "
%26%23
" << 整数を直列化する( エラーになり得る ) << "%3B
" If potentialError is non-null, then append "%26%23", followed by the shortest sequence of ASCII digits representing potentialError in base ten, followed by "%3B", to output.注記: これは、 符号化法 が UTF-8 でないとき起こり得る。 This can happen when encoding is not UTF-8.
- ELSE :BREAK ↑↑
- RETURN 出力 Return output.
注記:
引数 %-符号化集合 用に可能な値のうち,
%-符号化する対象に U+0025 (%) を含むものは、[
成分 %-符号化集合,
application/x-www-form-urlencoded
%-符号化集合
]に限られる
— したがって, “往復可能なデータ” を与える。
他の値
— URL 構文解析器に利用され得るもの —
は、
U+0025 (%) には触れないまま残す
— そのようなわけで、
適正に表現するためには,まず符号位置を UTF-8 %-符号化する必要がある。
Of the possible values for the percentEncodeSet argument only two end up encoding U+0025 (%) and thus give “roundtripable data”: component percent-encode set and application/x-www-form-urlencoded percent-encode set. The other values for the percentEncodeSet argument — which happen to be used by the URL parser — leave U+0025 (%) untouched and as such it needs to be percent-encoded first in order to be properly represented.
符号位置を UTF-8 %-符号化する アルゴリズムは、 所与の ( スカラー値 スカラー値, 符号位置たちが成す集合 %-符号化集合 ) に対し :RETURN 文字列を符号化してから %-符号化する( UTF-8 , スカラー値 1 個からなる文字列, %-符号化集合 ) To UTF-8 percent-encode a scalar value scalarValue using a percentEncodeSet, return the result of running percent-encode after encoding with UTF-8, scalarValue as a string, and percentEncodeSet.
文字列を UTF-8 %-符号化する アルゴリズムは、 所与の ( スカラー値文字列 入力, 符号位置たちが成す集合 %-符号化集合 ) に対し :RETURN 文字列を符号化してから %-符号化する( UTF-8 , 入力, %-符号化集合 ) To UTF-8 percent-encode a scalar value string input using a percentEncodeSet, return the result of running percent-encode after encoding with UTF-8, input, and percentEncodeSet.
上で定義した各 演算を例により要約する: Here is a summary, by way of example, of the operations defined above:
演算 | 入力例 | 出力例 |
---|---|---|
バイトを文字列に %-符号化する( 入力 ) | 0x23 | "%23 "
|
0x7F | "%7F "
| |
バイト列をバイト列に %-復号する( 入力 ) | `%25%s%1G `
| `%%s%1G `
|
文字列をバイト列に %-復号する( 入力 ) | "‽%25%2E "
| 0xE2 0x80 0xBD 0x25 0x2E |
文字列を符号化してから %-符号化する( Shift_JIS , 入力, ユーザ情報 %-符号化集合 ) | " "
| "%20 "
|
"≡ "
| "%81%DF "
| |
"‽ "
| "%26%238253%3B "
| |
文字列を符号化してから %-符号化する( ISO-2022-JP , 入力, ユーザ情報 %-符号化集合 ) | "¥ "
| "%1B(J\%1B(B "
|
文字列を符号化してから %-符号化する( Shift_JIS , 入力, ユーザ情報 %-符号化集合, true ) | "1+1 ≡ 2%20‽ "
| "1+1+%81%DF+2%20%26%238253%3B "
|
符号位置を UTF-8 %-符号化する( 入力, ユーザ情報 %-符号化集合 ) | U+2261 (≡) | "%E2%89%A1 "
|
U+203D (‽) | "%E2%80%BD "
| |
文字列を UTF-8 %-符号化する( 入力, ユーザ情報 %-符号化集合 ) | "Say what‽ "
| "Say%20what%E2%80%BD "
|
2. セキュリティの考慮点
URL のセキュリティは、 その環境の役務である。 URL を[ 周りに向けて具現化する/渡す, あるいは 周りのそれを解釈する ]ときには、 注意すること。 The security of a URL is a function of its environment. Care is to be taken when rendering, interpreting, and passing URLs around.
新たな URL を[ 具現化する/割り振る ]ときは、 “偽装( spoofing, なりすまし)” について考慮する必要がある。 [ ホスト/URL ]による攻撃は、 誰かを別のそれに混同させる可能性がある。 一例として、 1/l/I, m/rn/rri, 0/O, а/a は,どれも酷似するものになり得る†。 U+202A LEFT-TO-RIGHT EMBEDDING 等々のような,より問題になる不可視な符号位置すらある††。 [UTR36] When rendering and allocating new URLs "spoofing" needs to be considered. An attack whereby one host or URL can be confused for another. For instance, consider how 1/l/I, m/rn/rri, 0/O, and а/a can all appear eerily similar. Or worse, consider how U+202A LEFT-TO-RIGHT EMBEDDING and similar code points are invisible. [UTR36]
【 “具現化( rendering )” には、 描画に限らず,音声化なども含まれる。 】【† 一般には見かけ(あるいは発音)が異なる文字でも、 環境にて可用なフォント(あるいはボイス)に依存して酷似するかもしれない。 非 英語話者にとっては、 見かけは異なっていても似た発音として記憶しているため, 錯覚し易いものもあるかもしれない (例: correction と collection )。 】【†† 空間すら占めないことに加え、 Unicode 双方向アルゴリズムも適用する下で描画された場合, 前後の字の並び順までも変わる。 】【 参考: [IDNFAQ] 】
主体 A から主体 B へ URL が渡されるときは、 両主体とも,何が起きるか注意深く考慮する必要がある。 A は、 意に反してデータを漏洩するはめになり得る。 B は、 自身が予期していない入力を受け取って利用者に害を及ぼす動作をとる可能性がある。 特に、 B は,決して A を信用するべきでない — 渡される URL は、 常に信用できるソースから来ているとは限らないので。 When passing a URL from party A to B, both need to carefully consider what is happening. A might end up leaking data it does not want to leak. B might receive input it did not expect and take an action that harms the user. In particular, B should never trust A, as at some point URLs from A can come from untrusted sources.
3. ホスト(ドメインと IP アドレス)
高レベルからは、[ ホスト, 妥当なホスト文字列, ホスト構文解析器, ホスト直列化器 ]は,次のように関係する: At a high level, a host, valid host string, host parser, and host serializer relate as follows:
- ホスト構文解析器は、 任意なスカラー値文字列に対し[ 失敗, または ホスト ]を返す。 The host parser takes an arbitrary scalar value string and returns either failure or a host.
- ホストは、 メモリー内の表現と捉えることもできる。 A host can be seen as the in-memory representation.
- 妥当なホスト文字列は、 ホスト構文解析器に与えたときに,検証エラーや 失敗 を誘発しない — すなわち、[ 適合する/妥当である ]と見なされる — ような入力を定義する。 A valid host string defines what input would not trigger a validation error or failure when given to the host parser. I.e., input that would be considered conforming or valid.
- ホスト直列化器は、 入力のホストに対し,ASCII 文字列を返す。 (その文字列をさらにホスト構文解析器にかけた結果は、 元のホストと同等なホストになる。) The host serializer takes a host and returns an ASCII string. (If that string is then parsed, the result will equal the host that was serialized.)
[ ホスト構文解析器, ホスト直列化器 ]を順に適用して往復した結果は、 ホスト構文解析器の引数 不透明か に依存して,次のようになる: A parse-serialize roundtrip gives the following results, depending on the isOpaque argument to the host parser:
入力 | 出力( 不透明か = false ) | 出力( 不透明か = true ) |
---|---|---|
EXAMPLE.COM
| example.com (ドメイン)
| EXAMPLE.COM (不透明なホスト)
|
example%2Ecom
| example.com (ドメイン)
| example%2Ecom (不透明なホスト)
|
faß.example
| xn--fa-hia.example (ドメイン)
| fa%C3%9F.example (不透明なホスト)
|
0
| 0.0.0.0 (IPv4 アドレス)
| 0 (不透明なホスト)
|
%30
| 0.0.0.0 (IPv4 アドレス)
| %30 (不透明なホスト)
|
0x
| 0.0.0.0 (IPv4 アドレス)
| 0x (不透明なホスト)
|
0xffffffff
| 255.255.255.255 (IPv4 アドレス)
| 0xffffffff (不透明なホスト)
|
[0:0::1]
| [::1] (IPv6 アドレス)
| [::1] (IPv6 アドレス)
|
[0:0::1%5D
| 失敗 | 失敗 |
[0:0::%31]
| 失敗 | 失敗 |
09
| 失敗 | 09 (不透明なホスト)
|
example.255
| 失敗 | example.255 (不透明なホスト)
|
example^example
| 失敗 | 失敗 |
3.1. ホスト表現
ホスト は、[ ドメイン, IP アドレス, 不透明なホスト, 空ホスト ]のいずれかである。 ホストは,概してネットワークアドレスとしてサーブするが、 ネットワークアドレスが必要とされない所では, URL 内で 不透明な識別子として利用されることもある。 A host is a domain, an IP address, an opaque host, or an empty host. Typically a host serves as a network address, but it is sometimes used as opaque identifier in URLs where a network address is not necessary.
ホストが不透明なホストである URL の典型的な例
:git://github.com/whatwg/url.git
A typical URL whose host is an opaque host is git://github.com/whatwg/url.git.
注記: 下の各 段落内で参照されている RFC は、 参考目的に限られる。 それらは、 ホストの[ 書式, 構文解析法, 直列化 ]には何ら波及しない — 以下の節にて他が言明されない限り。 The RFCs referenced in the paragraphs below are for informative purposes only. They have no influence on host writing, parsing, and serialization. Unless stated otherwise in the sections that follow.
ドメイン とは、 ネットワークの中の realm を識別する空でない ASCII 文字列である。 [RFC1034] A domain is a non-empty ASCII string that identifies a realm within a network. [RFC1034]
ドメイン ドメイン の ドメインラベル群 は、 次の結果を返す :区切子で厳密に分割する( ドメイン, U+002E (.) ) The domain labels of a domain domain are the result of strictly splitting domain on U+002E (.).
2 つのドメイン
"example.com
" と "example.com.
"
は、
等価ではなく,概して別物に扱われる。
The example.com and example.com. domains are not equivalent and typically treated as distinct.
IP アドレス は、[ IPv4 アドレス/IPv6 アドレス ]である。 An IP address is an IPv4 address or an IPv6 address.
IPv4 アドレス は、 ネットワークアドレスを識別する 32 ビットな無符号整数である。 [RFC791] An IPv4 address is a 32-bit unsigned integer that identifies a network address. [RFC791]
IPv6 アドレス は、 ネットワークアドレスを識別する 128 ビットな無符号整数である。 この整数は、 IPv6 アドレスの piece 群 とも称される,[ 8 個の 16 ビットな無符号整数 ]が成すリストで構成される。 [RFC4291] An IPv6 address is a 128-bit unsigned integer that identifies a network address. This integer is composed of a list of 8 16-bit unsigned integers, also known as an IPv6 address’s pieces. [RFC4291]
注記:
<zone_id>
のサポートは、
意図的に除かれている。
Support for <zone_id> is intentionally omitted.
不透明なホスト は、 空でない ASCII 文字列であり,更なる処理に利用され得る。 An opaque host is a non-empty ASCII string that can be used for further processing.
空ホスト は、 空文字列である。 An empty host is the empty string.
3.2. ホストのその他諸々
次に挙げる符号位置は 禁止ホスト符号位置 とされる :U+0000 NULL, U+0009 TAB, U+000A LF, U+000D CR, U+0020 SPACE, U+0023 (#), U+002F (/), U+003A (:), U+003C (<), U+003E (>), U+003F (?), U+0040 (@), U+005B ([), U+005C (\), U+005D (]), U+005E (^), U+007C (|) A forbidden host code point is U+0000 NULL, U+0009 TAB, U+000A LF, U+000D CR, U+0020 SPACE, U+0023 (#), U+002F (/), U+003A (:), U+003C (<), U+003E (>), U+003F (?), U+0040 (@), U+005B ([), U+005C (\), U+005D (]), U+005E (^), or U+007C (|).
次に挙げる符号位置は 禁止ドメイン符号位置 とされる :禁止ホスト符号位置, C0 制御文字, U+0025 (%), U+007F DELETE A forbidden domain code point is a forbidden host code point, a C0 control, U+0025 (%), or U+007F DELETE.
所与の ( ホスト ホスト ) の 公共接尾辞 ( public suffix ) 得る アルゴリズムは、[ null /[ ホスト 内の[ 公共接尾辞リスト( PublicSuffixList ) [PSL] に含まれる部位 ]を表現しているドメイン ]]を返す: To obtain the public suffix of a host host, run these steps. They return null or a domain representing a portion of host that is included on the Public Suffix List. [PSL]
- IF[ ホスト はドメインでない ] :RETURN null If host is not a domain, then return null.
-
末尾のドット :← [
ホスト は "
.
" で終端しているならば ".
" / 他の場合は 空文字列 ] Let trailingDot be "." if host ends with "."; otherwise the empty string. - 公共接尾辞 :← 公共接尾辞リストのアルゴリズムをドメインとして ホスト を与えて走らせた結果の公共接尾辞 [PSL] Let publicSuffix be the public suffix determined by running the Public Suffix List algorithm with host as domain. [PSL]
-
Assert:[
公共接尾辞 は ASCII 文字列である
]∧[
公共接尾辞 は "
.
" で終端していない ] Assert: publicSuffix is an ASCII string that does not end with ".". - RETURN [ 公共接尾辞, 末尾のドット ]を順に連結した結果 Return publicSuffix and trailingDot concatenated.
所与の ( ホスト ホスト ) の 登録可能なドメイン ( registrable domain ) を得る アルゴリズムは、[ null /[ ホスト の公共接尾辞と[ それに先行しているドメインラベルが在れば それ ]により形成されるドメイン ]]を返す: To obtain the registrable domain of a host host, run these steps. They return null or a domain formed by host’s public suffix and the domain label preceding it, if any.
- IF[ ホスト の公共接尾辞 = null ]∨[ ( ホスト の公共接尾辞, ホスト ) は同等なホストである ] :RETURN null If host’s public suffix is null or host’s public suffix equals host, then return null.
-
末尾のドット :← [
ホスト は "
.
" で終端しているならば ".
" / 他の場合は 空文字列 ] Let trailingDot be "." if host ends with "."; otherwise the empty string. - 登録可能なドメイン :← 公共接尾辞リストのアルゴリズムをドメインとして ホスト を与えて走らせた結果の登録可能なドメイン [PSL] Let registrableDomain be the registrable domain determined by running the Public Suffix List algorithm with host as domain. [PSL]
-
Assert:[
登録可能なドメイン は ASCII 文字列である
]∧[
登録可能なドメイン は "
.
" で終端していない ] Assert: registrableDomain is an ASCII string that does not end with ".". - RETURN [ 登録可能なドメイン, 末尾のドット ]を順に連結した結果 Return registrableDomain and trailingDot concatenated.
入力ホスト Host input | 公共接尾辞 Public suffix | 登録可能なドメイン Registrable domain |
---|---|---|
com
| com
| null |
example.com
| com
| example.com
|
www.example.com
| com
| example.com
|
sub.www.example.com
| com
| example.com
|
EXAMPLE.COM
| com
| example.com
|
example.com.
| com.
| example.com.
|
github.io
| github.io
| null |
whatwg.github.io
| github.io
| whatwg.github.io
|
إختبار
| xn--kgbechtv
| null |
example.إختبار
| xn--kgbechtv
| example.xn--kgbechtv
|
sub.example.إختبار
| xn--kgbechtv
| example.xn--kgbechtv
|
[2001:0db8:85a3:0000:0000:8a2e:0370:7334]
| null | null |
仕様は、 セキュリティの裁定を為すときには,生成元の概念を選好するべきである。 [ “公共接尾辞” / “登録可能なドメイン” ]の観念に依存することでは、 堅固なセキュリティ境界は供せない — 公共接尾辞リストは,クライアントごとに分岐するので。 この助言を無視する仕様は、 そこで為す裁定の中に,URL のスキームは組み入れるべきとされるかどうか — すなわち,[ 同じサイト/スキーム無しで同じサイト ]の概念を利用するかどうか — について,注意深く考慮することが奨励される。 Specifications should prefer the origin concept for security decisions. The notion of "public suffix" and "registrable domain" cannot be relied-upon to provide a hard security boundary, as the public suffix list will diverge from client to client. Specifications which ignore this advice are encouraged to carefully consider whether URLs' schemes ought to be incorporated into any decisions made, i.e. whether to use the same site or schemelessly same site concepts.
3.3. IDNA
ドメインを ASCII 化する アルゴリズムは、 所与の ( 文字列 ドメイン, 真偽値 厳密か ) に対し: The domain to ASCII algorithm, given a string domain and a boolean beStrict, runs these steps:
-
結果 :← 次を与える下で, Unicode ToASCII を走らせた結果 [UTS46] :domain_name ← ドメイン, CheckHyphens ← 厳密か, CheckBidi ← true, CheckJoiners ← true, UseSTD3ASCIIRules ← 厳密か, Transitional_Processing ← false, VerifyDnsLength ← 厳密か, IgnoreInvalidPunycode ← false Let result be the result of running Unicode ToASCII with domain_name set to domain, CheckHyphens set to beStrict, CheckBidi set to true, CheckJoiners set to true, UseSTD3ASCIIRules set to beStrict, Transitional_Processing set to false, VerifyDnsLength set to beStrict, and IgnoreInvalidPunycode set to false. [UTS46]
注記: ∧↓ 次が満たされる場合、 この段は ドメイン を ASCII 小文字化することと等価になる:
- 厳密か = false
- ドメイン は ASCII 文字列である
-
次の結果
:区切子で厳密に分割する( ドメイン, U+002E (.) )
を成す どのアイテムも,次を満たす
:[
ASCII 大小無視で "
xn--
" に合致する文字列 ]から開始していない
- IF[ 結果 = 失敗 ] :検証エラー( domain-to-ASCII ); RETURN 失敗 If result is a failure value, domain-to-ASCII validation error, return failure.
-
IF[ 厳密か = false ]: If beStrict is false:
- IF[ 結果 = 空文字列 ] :検証エラー( domain-to-ASCII ); RETURN 失敗 If result is the empty string, domain-to-ASCII validation error, return failure.
-
IF[ 結果 内に禁止ドメイン符号位置が在る ] :検証エラー( domain-invalid-code-point ); RETURN 失敗 If result contains a forbidden domain code point, domain-invalid-code-point validation error, return failure.
注記: [ web 互換性, DNS に基づかないシステムとの互換性 ]に因り、 禁止ドメイン符号位置は,[ UseSTD3ASCIIRules が true をとるときには許容されない符号位置たち ]の下位集合を成す。 課題 #397 も見よ。 Due to web compatibility and compatibility with non-DNS-based systems the forbidden domain code points are a subset of those disallowed when UseSTD3ASCIIRules is true. See also issue #397.
-
Assert: [ 結果 ≠ 空文字列 ]∧[ 結果 内に禁止ドメイン符号位置は無い ] Assert: result is not the empty string and does not contain a forbidden domain code point.
注記: [ 厳密か = true ]のときには、 [UTS46] が,これが満たされることを保証する。 Unicode IDNA Compatibility Processing guarantees this holds when beStrict is true. [UTS46]
- RETURN 結果 Return result.
注記:
この文書および web プラットフォームは、
IDNA2008 [RFC5890] ではなく,
Unicode IDNA Compatibility Processing [UTS46]
【 “Unicode IDNA 互換性処理” 】
を全般的に利用する。
一例として、
"☕.example
" は,
失敗 ではなく "xn--53h.example
" になる。
This document and the web platform at large use Unicode IDNA Compatibility Processing and not IDNA2008. For instance, ☕.example becomes xn--53h.example and not failure. [UTS46] [RFC5890]
ドメインを Unicode 化する アルゴリズムは、 所与の ( ドメイン ドメイン, 真偽値 厳密か ) に対し: The domain to Unicode algorithm, given a domain domain and a boolean beStrict, runs these steps:
- 結果 :← 次を与える下で, Unicode ToUnicode を走らせた結果 [UTS46] :domain_name ← ドメイン, CheckHyphens ← 厳密か, CheckBidi ← true, CheckJoiners ← true, UseSTD3ASCIIRules ← 厳密か, Transitional_Processing ← false, IgnoreInvalidPunycode ← false Let result be the result of running Unicode ToUnicode with domain_name set to domain, CheckHyphens set to beStrict, CheckBidi set to true, CheckJoiners set to true, UseSTD3ASCIIRules set to beStrict, Transitional_Processing set to false, and IgnoreInvalidPunycode set to false. [UTS46]
- IF[ 結果 には何らかのエラーが記録された ] :検証エラー( domain-to-Unicode ) Signify domain-to-Unicode validation errors for any returned errors, and then,\
- RETURN 結果 return result.
3.4. ホストの書式
妥当なホスト文字列 は、 次のいずれかでなければならない:
- 妥当なドメイン文字列
- 妥当な IPv4 アドレス文字列
-
次の並び:
- U+005B ([)
- 妥当な IPv6 アドレス文字列
- U+005D (])
文字列 入力 が 妥当なドメイン であるとは、[ 次の結果 ≠ 失敗 ]になることをいう :ドメインを ASCII 化する( 入力, true ) A string input is a valid domain if these steps return true: • Let domain be the result of running domain to ASCII with input and true. • Return false if domain is failure; otherwise true.
課題: 理想的には、 妥当なドメインを成す符号位置並びに基づいて定義したい所 — モグラ叩きのように定義するのではなく: 課題 #245 Ideally we define this in terms of a sequence of code points that make up a valid domain rather than through a whack-a-mole: issue 245.
妥当なドメイン文字列 は、 妥当なドメインを与える文字列でなければならない。 A valid domain string must be a string that is a valid domain.
妥当な IPv4 アドレス文字列 は、[ U+002E (.) で分離された, 4 個の[ 次を満たす最短な文字列 ]が成す並び ]でなければならない :[ 1 個以上の ASCII 数字のみからなる ]∧[ それが表現する 10 進数 ∈ { 0 〜 255 } ] A valid IPv4-address string must be four shortest possible strings of ASCII digits, representing a decimal number in the range 0 to 255, inclusive, separated from each other by U+002E (.).
妥当な IPv6 アドレス文字列 は、 IP Version 6 Addressing Architecture § Text Representation of Addresses ( § アドレスのテキスト表現)にて定義される。 [RFC4291] A valid IPv6-address string is defined in the "Text Representation of Addresses" chapter of IP Version 6 Addressing Architecture. [RFC4291]
妥当な不透明なホスト文字列 は、 次に挙げる いずれかでなければならない: A valid opaque-host string must be one of the following:
- 1 個以上の[ 次を満たす URL 単位 ]たちが成す並び :禁止ホスト符号位置でない one or more URL units excluding forbidden host code points
-
次の並び:
- U+005B ([)
- 妥当な IPv6 アドレス文字列
- U+005D (])
注記: これは、 妥当なホスト文字列の定義を成す一部ではない — それには、 文脈を判別することが要求されるので。 This is not part of the definition of valid host string as it requires context to be distinguished.
3.5. ホストの構文解析法
ホスト構文解析器 は、 所与の ( スカラー値文字列 入力, 真偽値 不透明か (省略時は false ) ) に対し,[ 失敗 /ホスト ]を返す: The host parser takes a scalar value string input with an optional boolean isOpaque (default false), and then runs these steps. They return failure or a host.
-
IF[ 入力 の先頭 = U+005B ([) ]: If input starts with U+005B ([), then:
- IF[ 入力 の末尾 ≠ U+005D (]) ] :検証エラー( IPv6-unclosed ); RETURN 失敗 If input does not end with U+005D (]), IPv6-unclosed validation error, return failure.
- RETURN IPv6 構文解析器( 入力 から先頭の U+005B ([) と末尾の U+005D (]) を除去した結果 ) Return the result of IPv6 parsing input with its leading U+005B ([) and trailing U+005D (]) removed.
- IF[ 不透明か = true ] :RETURN 不透明なホスト構文解析器( 入力 ) If isOpaque is true, then return the result of opaque-host parsing input.
- Assert: 入力 ≠ 空文字列 Assert: input is not the empty string.
-
ドメイン :← BOM はそのままに UTF-8 復号する( 文字列をバイト列に %-復号する( 入力 ) ) Let domain be the result of running UTF-8 decode without BOM on the percent-decoding of input.
注記: 別法として、 BOM も失敗もそのままに UTF-8 復号するアルゴリズムを利用した上で, 失敗 時には早々に RETURN することもできる — ドメインを ASCII 化するのは U+FFFD REPLACEMENT CHARACTER に対し失敗するので。 Alternatively UTF-8 decode without BOM or fail can be used, coupled with an early return for failure, as domain to ASCII fails on U+FFFD (�).
- ASCII ドメイン :← ドメインを ASCII 化する( ドメイン, false ) Let asciiDomain be the result of running domain to ASCII with domain and false.
- IF[ ASCII ドメイン = 失敗 ] :RETURN 失敗 If asciiDomain is failure, then return failure.
- IF[ 番号で終端しているか検査する( ASCII ドメイン ) = true ] :RETURN IPv4 構文解析器( ASCII ドメイン ) If asciiDomain ends in a number, then return the result of IPv4 parsing asciiDomain.
- RETURN ASCII ドメイン Return asciiDomain.
番号で終端しているか検査する アルゴリズムは、 所与の ( ASCII 文字列 入力 ) に対し,真偽値を返す: The ends in a number checker takes an ASCII string input and then runs these steps. They return a boolean.
- 成分リスト :← 区切子で厳密に分割する( 入力, U+002E (.) ) Let parts be the result of strictly splitting input on U+002E (.).
-
IF[ 成分リスト の最後のアイテム = 空文字列 ]: If the last item in parts is the empty string, then:
- 最後のアイテム :← 成分リスト の最後のアイテム Let last be the last item in parts.
-
IF[ 最後のアイテム は 1 個以上の ASCII 数字のみからなる ] :RETURN true If last is non-empty and contains only ASCII digits, then return true.
注記: エラー含みの入力 "
09
" は、 後の段にて IPv4 構文解析器により catch されることになる。 The erroneous input "09" will be caught by the IPv4 parser at a later stage. -
IF[ IPv4 番号構文解析器( 最後のアイテム ) ≠ 失敗 ] :RETURN true If parsing last as an IPv4 number does not return failure, then return true.
注記: これは、 最後のアイテム が次の並びか否か検査することに等価になる :"
0X
" または "0x
", 0 個以上の ASCII 16 進数字 This is equivalent to checking that last is "0X" or "0x", followed by zero or more ASCII hex digits. - RETURN false Return false.
IPv4 構文解析器 は、 所与の ( ASCII 文字列 入力 ) に対し,[ 失敗 /IPv4 アドレス ]を返す: The IPv4 parser takes an ASCII string input and then runs these steps. They return failure or an IPv4 address.
注記: 他の仕様は、 IPv4 構文解析器を直に呼び出さないこと。 代わりに,[ ホスト構文解析器の返り値が IPv4 アドレスになるかどうか ]を検査すること。 The IPv4 parser is not to be invoked directly. Instead check that the return value of the host parser is an IPv4 address.
- 成分リスト :← 区切子で厳密に分割する( 入力, U+002E (.) ) Let parts be the result of strictly splitting input on U+002E (.).
-
IF[ 成分リスト 内の最後のアイテム = 空文字列 ]: If the last item in parts is the empty string, then:
- 検証エラー( IPv4-empty-part ) IPv4-empty-part validation error.
-
IF[ 成分リスト のサイズ > 1 ] :成分リスト から最後のアイテムを除去する
【 入力 の末尾に余計な U+002E (.) があっても受容されることになる。 】
If parts’s size is greater than 1, then remove the last item from parts.
- IF[ 成分リスト のサイズ > 4 ] :検証エラー( IPv4-too-many-parts ); RETURN 失敗 If parts’s size is greater than 4, IPv4-too-many-parts validation error, return failure.
- 番号リスト :← 新たなリスト Let numbers be an empty list.
-
成分リスト を成す 各( 成分 ) に対し: For each part of parts:
- 結果 :← IPv4 番号構文解析器( 成分 ) Let result be the result of parsing part.
- IF[ 結果 = 失敗 ] :検証エラー( IPv4-non-numeric-part ); RETURN 失敗 If result is failure, IPv4-non-numeric-part validation error, return failure.
- ( 番号, 検証エラーか ) :← 結果 ↓
- IF[ 検証エラーか = true ] :検証エラー( IPv4-non-decimal-part ) If result[1] is true, IPv4-non-decimal-part validation error.
- 番号リスト に 番号 を付加する Append result[0] to numbers.
- 最後の index :← 番号リスト のサイズ − 1 ↓
-
範囲 { 0 〜 最後の index } を成す 各( i ) に対し,昇順に:
- IF[ 番号リスト[ i ] ≤ 255 ] :CONTINUE
- 検証エラー( IPv4-out-of-range-part )
- IF[ i ≠ 最後の index ] :RETURN 失敗
- IF[ 番号リスト[ 最後の index ]† ≥ ( 256 の ( 4 − 最後の index ) 乗 ) ] :RETURN 失敗 If the last item in numbers is greater than or equal to 256(5 − numbers’s size), then return failure.
- IPv4 :← 番号リスト[ 最後の index ] Let ipv4 be the last item in numbers.
- 番号リスト から最後のアイテムを除去する†† Remove the last item from numbers.
- カウンタ :← 0 Let counter be 0.
-
番号リスト を成す 各( n ) に対し: For each n of numbers:
- IPv4 += ( n × ( 256 の ( 3 − カウンタ ) 乗 ) ) Increment ipv4 by n × 256(3 − counter).
- カウンタ += 1 Increment counter by 1.
- RETURN IPv4 Return ipv4.
【†
最後のアイテムだけ特別扱い
— 例えば、
"100.100.25600
" は "100.100.100.0
" と等価になり,
"0xFFFFFFFF
" は "255.255.255.255
" と等価になる。
】【††
ここでも、
番号リスト のサイズが 4 に満たない場合は)最後のアイテムだけ特別扱い
— 例えば、
"100.100
" は "100.0.0.100
" と等価になる。
】
IPv4 番号構文解析器 は、 所与の ( ASCII 文字列 入力 ) に対し,[ 失敗 / ( 番号, 真偽値 ) が成すタプル ]を返す: The IPv4 number parser takes an ASCII string input and then runs these steps. They return failure or a tuple of a number and a boolean.
- IF[ 入力 = 空文字列 ] :RETURN 失敗 If input is the empty string, then return failure.
- 検証エラーか :← false Let validationError be false.
- R :← 10 Let R be 10.
-
IF[ 入力 の長さ ≥ 2 ]∧[ 入力 の先頭の符号位置 = U+0030 (0) ]:
- 検証エラーか ← true
- 入力 から先頭の符号位置を除去する
- R ← 8
- IF[ 入力 の先頭の符号位置 ∈ { U+0058 (X), U+0078 (x) } ] :入力 から先頭の符号位置を除去する; R ← 16
-
IF[ 入力 = 空文字列 ] :RETURN ( 0, true )
【 "
If input is the empty string, then return (0, true).0x
" / "0X
" が入力されたときも,ここに該当することになる。 】 - IF[ 入力 内に基数 R の数字でない符号位置が在る ] :RETURN 失敗 If input contains a code point that is not a radix-R digit, then return failure.
- 出力 :← 入力 を基数 R による表記と見なす下で,整数 値として解釈した結果 — R = 16 の場合、 各桁の ASCII 16 進数字を 0 〜 15 の値に対応付ける下で Let output be the mathematical integer value that is represented by input in radix-R notation, using ASCII hex digits for digits with values 0 through 15.
- RETURN ( 出力, 検証エラーか ) Return (output, validationError).
【
"0xAB.012.0X12.12
"
の様なホスト名も IPv4 アドレスと見なされ、
"0xAB
", "0X12
" は 16 進数,
"012
" は 8 進数,
"12
" は 10 進数
として解釈されることになる。
】
IPv6 構文解析器 は、 所与の ( スカラー値文字列 入力 ) に対し,[ 失敗 /IPv6 アドレス ]を返す: The IPv6 parser takes a scalar value string input and then runs these steps. They return failure or an IPv6 address.
注記: 他の仕様は、 理論上は,IPv6 構文解析器を直に呼び出すこともできるが、 実際にそれを行う前に,この文書の編集者たちと論じられたし。 The IPv6 parser could in theory be invoked directly, but please discuss actually doing that with the editors of this document first.
- アドレス :← 新たな IPv6 アドレス — その :piece 群 ← « 0, 0, 0, 0, 0, 0, 0, 0 » Let address be a new IPv6 address whose pieces are all 0.
- piece index :← 0 Let pieceIndex be 0.
- 圧縮 index :← null Let compress be null.
- ポインタ :← 入力 用のポインタ Let pointer be a pointer for input.
-
IF[ C = U+003A (:) ]: If c is U+003A (:), then:
- IF[ C1 ≠ U+003A (:) ] :検証エラー( IPv6-invalid-compression ); RETURN 失敗 If remaining does not start with U+003A (:), IPv6-invalid-compression validation error, return failure.
- ポインタ += 2 Increase pointer by 2.
- piece index += 1 Increase pieceIndex by 1 and then\
- 圧縮 index ← piece index set compress to pieceIndex.
-
WHILE [ C ≠ EOF ]: While c is not the EOF code point:
- IF[ piece index = 8 ] :検証エラー( IPv6-too-many-pieces ); RETURN 失敗 If pieceIndex is 8, IPv6-too-many-pieces validation error, return failure.
-
IF[ C = U+003A (:) ]: If c is U+003A (:), then:
- IF[ 圧縮 index ≠ null ] :検証エラー( IPv6-multiple-compression ); RETURN 失敗 If compress is non-null, IPv6-multiple-compression validation error, return failure.
- ポインタ += 1 ↓
- piece index += 1 Increase pointer and pieceIndex by 1,\
- 圧縮 index ← piece index set compress to pieceIndex,\
- CONTINUE and then continue.
- 値 :← 0 ↓
- 長さ :← 0 Let value and length be 0.
- WHILE [ 長さ < 4 ]∧[ C ∈ ASCII 16 進数字 ] :値 ← 値 × 0x10 + [ C を 16 進数として解釈した値 ]; ポインタ += 1; 長さ += 1 While length is less than 4 and c is an ASCII hex digit, set value to value × 0x10 + c interpreted as hexadecimal number, and increase pointer and length by 1.
-
IF[ C = U+002E (.) ]: If c is U+002E (.), then:
- IF[ 長さ = 0 ] :検証エラー( IPv4-in-IPv6-invalid-code-point ); RETURN 失敗 If length is 0, IPv4-in-IPv6-invalid-code-point validation error, return failure.
- ポインタ −= 長さ Decrease pointer by length.
- IF[ piece index > 6 ] :検証エラー( IPv4-in-IPv6-too-many-pieces ); RETURN 失敗 If pieceIndex is greater than 6, IPv4-in-IPv6-too-many-pieces validation error, return failure.
- IPv4 個数 :← 0 Let numbersSeen be 0.
-
WHILE [ C ≠ EOF ]: While c is not the EOF code point:
- IPv4 piece :← null Let ipv4Piece be null.
-
IF[ IPv4 個数 > 0 ]: If numbersSeen is greater than 0, then:
- IF[ C = U+002E (.) ]∧[ IPv4 個数 < 4 ] :ポインタ += 1 If c is a U+002E (.) and numbersSeen is less than 4, then increase pointer by 1.
- ELSE :検証エラー( IPv4-in-IPv6-invalid-code-point ); RETURN 失敗 Otherwise, IPv4-in-IPv6-invalid-code-point validation error, return failure.
- IF[ C ∉ ASCII 数字 ] :検証エラー( IPv4-in-IPv6-invalid-code-point ); RETURN 失敗 If c is not an ASCII digit, IPv4-in-IPv6-invalid-code-point validation error, return failure.
-
WHILE [ C ∈ ASCII 数字 ]: While c is an ASCII digit:
- IF[ IPv4 piece = 0 ] :検証エラー( IPv4-in-IPv6-invalid-code-point ); RETURN 失敗 Let number be c interpreted as decimal number.If ipv4Piece is null, then set ipv4Piece to number.Otherwise, if ipv4Piece is 0, IPv4-in-IPv6-invalid-code-point validation error, return failure.
- IF[ IPv4 piece = null ] :IPv4 piece ← 0 ↑
- IPv4 piece ← IPv4 piece × 10 + [ C を 10 進数として解釈した値 ] Otherwise, set ipv4Piece to ipv4Piece × 10 + number.
- IF[ IPv4 piece > 255 ] :検証エラー( IPv4-in-IPv6-out-of-range-part ); RETURN 失敗 If ipv4Piece is greater than 255, IPv4-in-IPv6-out-of-range-part validation error, return failure.
- ポインタ += 1 Increase pointer by 1.
- アドレス[ piece index ] ← アドレス[ piece index ] × 0x100 + IPv4 piece Set address[pieceIndex] to address[pieceIndex] × 0x100 + ipv4Piece.
- IPv4 個数 += 1 Increase numbersSeen by 1.
- IF[ IPv4 個数 ∈ { 2, 4 } ] :piece index += 1 If numbersSeen is 2 or 4, then increase pieceIndex by 1.
- IF[ IPv4 個数 ≠ 4 ] :検証エラー( IPv4-in-IPv6-too-few-parts ); RETURN 失敗 If numbersSeen is not 4, IPv4-in-IPv6-too-few-parts validation error, return failure.
- BREAK Break.
-
ELSE IF[ C = U+003A (:) ]: Otherwise, if c is U+003A (:):
- ポインタ += 1 Increase pointer by 1.
- IF[ C = EOF ] :検証エラー( IPv6-invalid-code-point ); RETURN 失敗 If c is the EOF code point, IPv6-invalid-code-point validation error, return failure.
- ELSE IF[ C ≠ EOF ] :検証エラー( IPv6-invalid-code-point ); RETURN 失敗 Otherwise, if c is not the EOF code point, IPv6-invalid-code-point validation error, return failure.
- アドレス[ piece index ] ← 値 Set address[pieceIndex] to value.
- piece index += 1 Increase pieceIndex by 1.
-
IF[ 圧縮 index ≠ null ]: If compress is non-null, then:
- swap 数 :← piece index − 圧縮 index Let swaps be pieceIndex − compress.
- piece index ← 7 Set pieceIndex to 7.
- WHILE [ piece index ≠ 0 ]∧[ swap 数 > 0 ] :アドレス[ piece index ] と アドレス[ 圧縮 index + swap 数 − 1 ] の値を swap する; piece index −= 1; swap 数 −= 1 While pieceIndex is not 0 and swaps is greater than 0, swap address[pieceIndex] with address[compress + swaps − 1], and then decrease both pieceIndex and swaps by 1.
【 この段は妙にまわりくどい — 実質的には、 次と等価になる:
- piece index ← 7
- WHILE [ piece index > 圧縮 index ] :アドレス[ piece index ] と アドレス[ piece index − 1 ] の値を swap する; piece index −= 1 While pieceIndex is not 0 and swaps is greater than 0, swap address[pieceIndex] with address[compress + swaps − 1], and then decrease both pieceIndex and swaps by 1.
すなわち、 アドレス[ 7 ] を アドレス[ 圧縮 index ] へ移動して, アドレス[ 圧縮 index ] 以降を一つずらしているが、 正しいふるまいとは思えない。 本当は、 アドレス[ 圧縮 index ] の直前に必要とされる個数の 0 を挿入するべきでは? — それに伴い、 このアルゴリズムの他所も改める必要があるが。 】
- ELSE :IF[ piece index ≠ 8 ] :検証エラー( IPv6-too-few-pieces ); RETURN 失敗 Otherwise, if compress is null and pieceIndex is not 8, IPv6-too-few-pieces validation error, return failure.
- RETURN アドレス Return address.
不透明なホスト構文解析器 は、 所与の ( スカラー値文字列 入力 ) に対し,[ 失敗 /不透明なホスト ]を返す: The opaque-host parser takes a scalar value string input, and then runs these steps. They return failure or an opaque host.
- IF[ 入力 内に禁止ホスト符号位置が在る ] :検証エラー( host-invalid-code-point ); RETURN 失敗 If input contains a forbidden host code point, host-invalid-code-point validation error, return failure.
-
IF[
入力 内に[
URL 符号位置, "
%
" ]以外の符号位置が在る ] :検証エラー( invalid-URL-unit ) If input contains a code point that is not a URL code point and not U+0025 (%), invalid-URL-unit validation error. -
IF[
入力 内に[
2 個の ASCII 16 進数字が後続していない "
%
" ]が在る ] :検証エラー( invalid-URL-unit ) If input contains a U+0025 (%) and the two code points following it are not ASCII hex digits, invalid-URL-unit validation error. - RETURN 文字列を UTF-8 %-符号化する( 入力, C0 制御文字 %-符号化集合 ) Return the result of running UTF-8 percent-encode on input using the C0 control percent-encode set.
3.6. ホストの直列化法
ホストを直列化する アルゴリズムは、 所与の ( ホスト ホスト ) に対し,ASCII 文字列を返す: The host serializer takes a host host and then runs these steps. They return an ASCII string.
-
ホスト の種別に応じて: ↓
- IPv4 アドレス :RETURN IPv4 直列化器( ホスト ) If host is an IPv4 address, return the result of running the IPv4 serializer on host.
- IPv6 アドレス :RETURN U+005B ([) << IPv6 直列化器( ホスト ) << U+005D (]) Otherwise, if host is an IPv6 address, return U+005B ([), followed by the result of running the IPv6 serializer on host, followed by U+005D (]).
- ドメイン / 不透明なホスト / 空ホスト :RETURN ホスト Otherwise, host is a domain, opaque host, or empty host, return host.
IPv4 直列化器 は、 所与の ( IPv4 アドレス アドレス ) に対し, ASCII 文字列を返す: The IPv4 serializer takes an IPv4 address address and then runs these steps. They return an ASCII string.
- 出力 :← 空文字列 Let output be the empty string.
- n :← アドレス Let n be the value of address.
-
{ 1 〜 4 } を成す 各( i ) に対し,昇順に: For each i in the range 1 to 4, inclusive:
- 出力 ← 整数を直列化する( n を 256 で割った余り ) << 出力 Prepend n % 256, serialized, to output.
- IF[ i ≠ 4 ] :U+002E (.) を 出力 の先頭に挿入する If i is not 4, then prepend U+002E (.) to output.
- n ← floor( n ÷ 256 ) Set n to floor(n / 256).
- RETURN 出力 Return output.
IPv6 直列化器 は、 所与の ( IPv6 アドレス アドレス ) に対し, ASCII 文字列を返す: The IPv6 serializer takes an IPv6 address address and then runs these steps. They return an ASCII string.
- 出力 :← 空文字列 Let output be the empty string.
- 圧縮 index :← IPv6 アドレスの圧縮された piece index を見出す( アドレス ) Let compress be the result of finding the IPv6 address compressed piece index given address.
- 無視するか :← false Let ignore0 be false.
-
アドレス の piece 群の index 群を成す 各( piece index ) に対し: For each pieceIndex of address’s pieces’s indices:
- IF[ 無視するか = true ]∧[ アドレス[ piece index ] = 0 ] :CONTINUE If ignore0 is true and address[pieceIndex] is 0, then continue.
- 無視するか ← false Otherwise, if ignore0 is true, set ignore0 to false.
-
IF[ 圧縮 index = piece index ]: If compress is pieceIndex, then:
-
出力 << [
piece index = 0 ならば "
::
" / 他の場合は ":
" ] Let separator be "::" if pieceIndex is 0; otherwise U+003A (:).Append separator to output. - 無視するか ← true Set ignore0 to true and continue.
- CONTINUE ↑
-
出力 << [
piece index = 0 ならば "
- 出力 << 次を満たす最短な文字列 :アドレス[ piece index ] を小文字 16 進数で表現している Append address[pieceIndex], represented as the shortest possible lowercase hexadecimal number, to output.
- IF[ piece index ≠ 7 ] :出力 << U+003A (:) If pieceIndex is not 7, then append U+003A (:) to output.
- RETURN 出力 Return output.
注記: このアルゴリズムは、 A Recommendation for IPv6 Address Text Representation (IPv6 アドレスの推奨表記)への準拠を要求する。 [RFC5952] 【参考:IPv6 アドレス表記の柔軟性が起こす問題と RFC5952 の解説】 This algorithm requires the recommendation from A Recommendation for IPv6 Address Text Representation. [RFC5952]
IPv6 アドレスの圧縮された piece index を見出す アルゴリズムは、 所与の ( IPv6 アドレス アドレス ) に対し: To find the IPv6 address compressed piece index given an IPv6 address address:
- 最長 index :← null Let longestIndex be null.
- 最長サイズ :← 1 Let longestSize be 1.
- 見出された index :← null Let foundIndex be null.
- 見出されたサイズ :← 0 Let foundSize be 0.
-
アドレス の piece 群の index 群を成す 各( piece index ) に対し: For each pieceIndex of address’s pieces’s indices:
-
IF[ アドレス の piece 群[ piece index ] ≠ 0 ]: If address’s pieces[pieceIndex] is not 0:
- IF[ 見出されたサイズ > 最長サイズ ] :最長 index ← 見出された index ; 最長サイズ ← 見出されたサイズ If foundSize is greater than longestSize, then set longestIndex to foundIndex and longestSize to foundSize.
- 見出された index ← null Set foundIndex to null.
- 見出されたサイズ ← 0 Set foundSize to 0.
-
ELSE: Otherwise:
- IF[ 見出された index = null ] :見出された index ← piece index If foundIndex is null, then set foundIndex to pieceIndex.
- 見出されたサイズ += 1 Increment foundSize by 1.
-
- IF[ 見出されたサイズ > 最長サイズ ] :RETURN 見出された index If foundSize is greater than longestSize, then return foundIndex.
- RETURN 最長 index Return longestIndex.
例えば, "0:f:0:0:f:f:0:0
" に対しては、
2 個目の 0 を指す index を返すことになる。
In 0:f:0:0:f:f:0:0 it would point to the second 0.
3.7. ホストの等価性
2 つのホスト ( A, B ) は、 次を満たすとき, そのときに限り 同等なホスト であるとされる :A と B は【互いの型が一致する, かつ値も】等しい To determine whether a host A equals host B, return true if A is B, and false otherwise.
課題: 証明書の比較には、[ ドメインの尾部のドットは無視する ]ような,ホストの等価性の検査が要求される。 しかしながら、 それらのホストには, ここでは施行されない DNS 長さなどの 他の種々の側面も施行される — URL はそれらを施行しないので。 これら 2 つを近づけるような, あるいは 統一化モデルとして何か良い示唆があれば,課題を申請されたし。 Certificate comparison requires a host equivalence check that ignores the trailing dot of a domain (if any). However, those hosts have also various other facets enforced, such as DNS length, that are not enforced here, as URLs do not enforce them. If anyone has a good suggestion for how to bring these two closer together, or what a good unified model would be, please file an issue.
4. URL
高レベルからは、[ URL レコード, 妥当な URL 文字列, URL 構文解析器, URL 直列化器 ]は,次のように関係する: At a high level, a URL, valid URL string, URL parser, and URL serializer relate as follows:
- URL 構文解析器は、 任意なスカラー値文字列に対し,[ 失敗, または URL レコード ]を返す。 また、 生じた各検証エラーも記録する。 The URL parser takes an arbitrary scalar value string and returns either failure or a URL. It might also record zero or more validation errors.
- URL レコードは、 メモリー内の表現と捉えることもできる。 A URL can be seen as the in-memory representation.
- 妥当な URL 文字列は、 URL 構文解析器にかけたときに,検証エラーや 失敗 を誘発しない — すなわち、[ 適合する/妥当である ]と見なされる — ような入力を定義する。 A valid URL string defines what input would not trigger a validation error or failure when given to the URL parser. I.e., input that would be considered conforming or valid.
- URL 直列化器は、 入力の URL レコードに対し,ASCII 文字列を返す。 (その文字列をさらに URL 構文解析器にかけた結果は、 元の URL レコードと同等な URL になる。) URL 直列化器の出力は、 常に妥当な URL 文字列になるとは限らない。 The URL serializer takes a URL and returns an ASCII string. (If that string is then parsed, the result will equal the URL that was serialized.) The output of the URL serializer is not always a valid URL string.
入力 URL Input | 基底 URL Base | 妥当か? Valid | 出力 URL Output |
---|---|---|---|
https:example.org
| ❌ | https://example.org/
| |
https://////example.com///
| ❌ | https://example.com///
| |
https://example.com/././foo
| ✅ | https://example.com/foo
| |
hello:world
| https://example.com/
| ✅ | hello:world
|
https:example.org
| https://example.com/
| ❌ | https://example.com/example.org
|
\example\..\demo/.\
| https://example.com/
| ❌ | https://example.com/demo/
|
example
| https://example.com/demo
| ✅ | https://example.com/example
|
file:///C|/demo
| ❌ | file:///C:/demo
| |
..
| file:///C:/demo
| ✅ | file:///C:/
|
file://loc%61lhost/
| ✅ | file:///
| |
https://user:password@example.org/
| ❌ | https://user:password@example.org/
| |
https://example.org/foo bar
| ❌ | https://example.org/foo%20bar
| |
https://EXAMPLE.com/../x
| ✅ | https://example.com/x
| |
https://ex ample.org/
| ❌ | 失敗 | |
example
| ❌† | 失敗 | |
https://example.com:demo
| ❌ | 失敗 | |
http://[www.example.com]/
| ❌ | 失敗 | |
https://example.org//
| ✅ | https://example.org//
| |
https://example.com/[]?[]#[]
| ❌ | https://example.com/[]?[]#[]
| |
https://example/%?%#%
| ❌ | https://example/%?%#%
| |
https://example/%25?%25#%25
| ✅ | https://example/%25?%25#%25
|
簡潔にするため、 ここでの[ 基底/出力 ]URL は,URL 直列化器にかけた結果で表現されている。 The base and output URL are represented in serialized form for brevity.
† — 基底 URL を欠くことに因り妥当でない。4.1. URL 表現
URL は、 以下に挙げるアイテムからなる構造体であり, 普遍的な識別子を表現する。 妥当な URL 文字列と区別するため、 URL レコードとも称される: A URL is a struct that represents a universal identifier. To disambiguate from a valid URL string it can also be referred to as a URL record.
- スキーム A URL’s scheme\
- ASCII 文字列 is an ASCII string\
- URL の種別を識別する — URL 構文解析器にかけた後の,更なる分岐処理に利用され得る。 that identifies the type of URL and can be used to dispatch a URL for further processing after parsing.\
- 初期時は空文字列とする。 It is initially the empty string.
- ユーザ名 A URL’s username\
- ASCII 文字列 is an ASCII string\
- ユーザ名を識別する。 identifying a username.\
- 初期時は空文字列とする。 It is initially the empty string.
- パスワード A URL’s password\
- ASCII 文字列 is an ASCII string\
- パスワードを識別する。 identifying a password.\
- 初期時は空文字列とする。 It is initially the empty string.
- ホスト A URL’s host\
- null / ホスト is null or a host.\
- 初期時は null とする。 It is initially null.
-
注記: URL に許容される[ スキーム, ホスト ]の組み合せを次の表に挙げる。
スキーム ホスト ドメイン IPv4 アドレス IPv6 アドレス 不透明なホスト 空ホスト null " file
" 以外の特別スキーム✅ ✅ ✅ ❌ ❌ ❌ " file
"✅ ✅ ✅ ❌ ✅ ❌ その他 ❌ ❌ ✅ ✅ ✅ ✅ - ポート A URL’s port\
- null / 16 ビットな無符号整数 is either null or a 16-bit unsigned integer\
- null 以外は、 ネットワーク用のポートを識別する。 that identifies a networking port.\
- 初期時は null とする。 It is initially null.
- パス A URL’s path\
- URL パス is a URL path,\
- 通例的には、 リソースの所在を識別する。 usually identifying a location.\
- 初期時は « » とする。 It is initially « ».
- 注記: URL が特別である場合、 そのパスは常にリストになり, 不透明なパスを有することは決してない。 A special URL’s path is always a list, i.e., it is never opaque.
- クエリ A URL’s query\
- null / ASCII 文字列 is either null or an ASCII string.\
- 初期時は null とする。 It is initially null.
- 素片 A URL’s fragment\
- null / ASCII 文字列 is either null or an ASCII string\
- null 以外は、[ URL を成す他の成分により識別されるリソース ]を更に処理するために利用され得る。 that can be used for further processing on the resource the URL’s other components identify.\
- 初期時は null とする。 It is initially null.
各 URL には、 blob URL エントリ も結び付けられる。 それは、[ null /blob URL エントリ ]であり,初期時は null とする。 A URL also has an associated blob URL entry that is either null or a blob URL entry. It is initially null.
注記:
これは、[
"blob
" URL が指しているオブジェクトを その生成元とともにキャッシュする
]ことをサポートするために利用される。
これらをキャッシュすることは、
重要になる
— そのような URL は、
構文解析してから fetch するまでの間に blob URL store から除去されるかもしれない一方で,
fetch 処理は成功する必要があるので。
This is used to support caching the object a "blob" URL refers to as well as its origin. It is important that these are cached as the URL might be removed from the blob URL store between parsing and fetching, while fetching will still need to succeed.
妥当な URL 文字列を URL 構文解析器にかけた結果が URL レコードの各成分にどう対応付けられるかを,次の表に挙げる。 この表から省略された[ ユーザ名/ パスワード/ blob URL エントリ ]は、 この例では,どれも[ 空文字列/空文字列/ null ]になる。 The following table lists how valid URL strings, when parsed, map to a URL’s components. Username, password, and blob URL entry are omitted; in the examples below they are the empty string, the empty string, and null, respectively.
入力 | スキーム | ホスト | ポート | パス | クエリ | 素片 |
---|---|---|---|---|---|---|
https://example.com/
| "https "
| "example.com "
| null | « 空文字列 » | null | null |
https://localhost:8000/search?q=text#hello
| "https "
| "localhost "
| 8000 | « "search " »
| "q=text "
| "hello "
|
urn:isbn:9780307476463
| "urn "
| null | null | "isbn:9780307476463 "
| null | null |
file:///ada/Analytical%20Engine/README.md
| "file "
| null | null | « "ada ", "Analytical%20Engine ", "README.md " »
| null | null |
URL パス は、 次のいずれかである :URL パス区分 / URL パス区分たちが成すリスト A URL path is either a URL path segment or a list of zero or more URL path segments.
URL パス区分 は、 ASCII 文字列である。 それは、 ある[ ディレクトリ/file ]を指すことが多いが,定義済みな意味は無い。 A URL path segment is an ASCII string. It commonly refers to a directory or a file, but has no predefined meaning.
単ドット URL パス区分
は、
次を満たす URL パス区分である
:ASCII 大小無視で[
".
" / "%2e
"
]に合致する
A single-dot URL path segment is a URL path segment that is "." or an ASCII case-insensitive match for "%2e".
二重ドット URL パス区分
は、
次を満たす URL パス区分である
:ASCII 大小無視で[
"..
" / ".%2e
" / "%2e.
" / "%2e%2e
"
]に合致する
A double-dot URL path segment is a URL path segment that is ".." or an ASCII case-insensitive match for ".%2e", "%2e.", or "%2e%2e".
4.2. URL のその他諸々
特別スキーム とは、 次の表の 1 列目に挙げられる ASCII 文字列である。 各特別スキーム用の 既定ポート は、 表の同じ行の 2 列目に挙げられる — 他の ASCII 文字列用の既定ポートは null とする。 A special scheme is an ASCII string that is listed in the first column of the following table. The default port for a special scheme is listed in the second column on the same row. The default port for any other ASCII string is null.
特別スキーム | 既定ポート |
---|---|
"ftp "
| 21 |
"file "
| null |
"http "
| 80 |
"https "
| 443 |
"ws "
| 80 |
"wss "
| 443 |
所与の URL が 特別 であるとは、 そのスキームは特別スキームであることをいう。 A URL is special if its scheme is a special scheme. A URL is not special if its scheme is not a special scheme.
【 原文では,一体句としての 特別でない が “特別である” の否定として定義されているが、 この訳では利用しない (単に “特別でない” と記すことにする)。 】
URL が 資格情報を含んで いるとは、 次を満たすことをいう :[ そのユーザ名 ≠ 空文字列 ]∨[ そのパスワード ≠ 空文字列 ] A URL includes credentials if its username or password is not the empty string.
【(参考) HTTP 仕様の § userinfo の非推奨化 にセキュリティに関する記述がある。 】
URL が 不透明なパス を有するとは、 次を満たすことをいう :そのパスは URL パス区分である【リストでない】 A URL has an opaque path if its path is a URL path segment.
URL が
ユーザ名/パスワード/ポートを有し得ない
とは、
次を満たすことをいう
:[
そのホスト ∈ { null , 空文字列 }
]∨[
そのスキーム = "file
"
]
A URL cannot have a username/password/port if its host is null or the empty string, or its scheme is "file".
URL は 基底 URL であるものと指名されることもある。 A URL can be designated as base URL.
注記: 基底 URL は、 URL 構文解析器において,相対 URL 文字列も入力にとり得るときに有用になる。 A base URL is useful for the URL parser when the input might be a relative-URL string.
Windows ドライブレター とは、 次を満たす 2 個の符号位置が成す並びである :[ 1 個目の符号位置 ∈ ASCII 英字 ]∧[ 2 個目の符号位置 ∈ { U+003A (:), U+007C (|) } ] A Windows drive letter is two code points, of which the first is an ASCII alpha and the second is either U+003A (:) or U+007C (|).
正規化済み Windows ドライブレター とは、 Windows ドライブレターのうち,次を満たすものである :2 個目の符号位置 = U+003A (:) A normalized Windows drive letter is a Windows drive letter of which the second code point is U+003A (:).
注記: § URL の書式により、 適合するものは正規化済み Windows ドライブレターに限られる。 As per the URL writing section, only a normalized Windows drive letter is conforming.
3 個の[ 符号位置 / EOF ]たちが成す並び[ C0, C1, C2 ]が Windows ドライブレターから開始して いるとは、 ∧↓ を満たすことをいう: A string starts with a Windows drive letter if all of the following are true:
- 並び[ C0, C1 ]は Windows ドライブレターである(特に,いずれも EOF でない) its length is greater than or equal to 2its first two code points are a Windows drive letter
- C2 ∈ { EOF, U+002F (/), U+005C (\), U+003F (?), U+0023 (#) } its length is 2 or its third code point is U+002F (/), U+005C (\), U+003F (?), or U+0023 (#).
並びが成す文字列 | Windows ドライブレターから開始しているか? |
---|---|
"c: "
| ✅ |
"c:/ "
| ✅ |
"c:a "
| ❌ |
URL の パスを短縮する アルゴリズムは: To shorten a url’s path:
- Assert: URL は不透明なパスを有さない。 Assert: url does not have an opaque path.
- パス :← URL のパス Let path be url’s path.
-
IF[
URL のスキーム = "
file
" ]∧[ パス のサイズ = 1 ]∧[ パス[ 0 ] は正規化済み Windows ドライブレターである ] :RETURN If url’s scheme is "file", path’s size is 1, and path[0] is a normalized Windows drive letter, then return. - IF[ パス は空でない ] :パス から最後のアイテムを除去する Remove path’s last item, if any.
4.3. URL の書式
以下において,“省略可能” と記された部分は省略できる/され得ることを意味する(すなわち, 0 個, または 1 個)。 ↓
妥当な URL 文字列 は、 次のいずれかでなければならない: A valid URL string must be either\
- 素片付き相対 URL 文字列 a relative-URL-with-fragment string\
- 素片付き絶対 URL 文字列 or an absolute-URL-with-fragment string.
素片付き絶対 URL 文字列 は、 次の並びでなければならない: An absolute-URL-with-fragment string must be\
- 絶対 URL 文字列 an absolute-URL string,\
-
省略可能な,次の並び:
- U+0023 (#)
- URL 素片文字列
絶対 URL 文字列 は、 次の並びでなければならない: An absolute-URL string must be\
-
次のいずれか: one of the following:
-
次の並び: ↓
-
URL スキーム文字列であって,[
"
file
" 以外の特別スキーム ]に ASCII 大小無視で合致するもの a URL-scheme string that is an ASCII case-insensitive match for a special scheme and not an ASCII case-insensitive match for "file",\ - U+003A (:) followed by U+003A (:)\
- スキーム相対特別 URL 文字列 and a scheme-relative-special-URL string
-
URL スキーム文字列であって,[
"
-
次の並び: ↓
- URL スキーム文字列であって,特別スキームに ASCII 大小無視で合致しないもの a URL-scheme string that is not an ASCII case-insensitive match for a special scheme,\
- U+003A (:) followed by U+003A (:)\
- 相対 URL 文字列 and a relative-URL string
-
次の並び: ↓
-
URL スキーム文字列であって, "
file
" に ASCII 大小無視で合致するもの a URL-scheme string that is an ASCII case-insensitive match for "file",\ - U+003A (:) followed by U+003A (:)\
- スキーム相対 file URL 文字列 and a scheme-relative-file-URL string
-
URL スキーム文字列であって, "
-
-
省略可能な,次の並び: any optionally followed by\
- U+003F (?) U+003F (?)\
- URL クエリ文字列 and a URL-query string.
URL スキーム文字列 は、 次の並びでなければならない: A URL-scheme string must be\
- 1 個の ASCII 英字 one ASCII alpha,\
- 0 個以上の次に挙げる符号位置たちが成す並び :ASCII 英数字, U+002B (+), U+002D (-), U+002E (.) followed by zero or more of ASCII alphanumeric, U+002B (+), U+002D (-), and U+002E (.).\
URL スキーム文字列 は、 IANA URI [sic] Schemes レジストリに登録されるべきである。 [IANA-URI-SCHEMES] [RFC7595] Schemes should be registered in the IANA URI [sic] Schemes registry. [IANA-URI-SCHEMES] [RFC7595]
素片付き相対 URL 文字列 は、 次の並びでなければならない: A relative-URL-with-fragment string must be\
- 相対 URL 文字列 a relative-URL string,\
-
省略可能な,次の並び: optionally followed by\
- U+0023 (#) U+0023 (#)\
- URL 素片文字列 and a URL-fragment string.
相対 URL 文字列 は、 次の並びでなければならない: A relative-URL string must be one of the following,\
-
基底 URL のスキームに応じて: switching on base URL’s scheme:
-
"
file
" 以外の特別スキームならば,次のいずれか: A special scheme that is not "file"- スキーム相対特別 URL 文字列 a scheme-relative-special-URL string
- パス絶対 URL 文字列 a path-absolute-URL string
- パス相対 スキームなし URL 文字列 a path-relative-scheme-less-URL string
-
"
file
" ならば,次のいずれか: "file"- スキーム相対 file URL 文字列 a scheme-relative-file-URL string
- パス絶対 URL 文字列 — ただし、[ 基底 URL のホストは空ホストである ]場合に限る a path-absolute-URL string if base URL’s host is an empty host
- パス絶対 非 Windows file URL 文字列 — ただし、[ 基底 URL のホストは空ホストでない ]場合に限る a path-absolute-non-Windows-file-URL string if base URL’s host is not an empty host
- パス相対 スキームなし URL 文字列 a path-relative-scheme-less-URL string
-
他の場合,次のいずれか: Otherwise
- スキーム相対 URL 文字列 a scheme-relative-URL string
- パス絶対 URL 文字列 a path-absolute-URL string
- パス相対 スキームなし URL 文字列 a path-relative-scheme-less-URL string
-
-
省略可能な,次の並び: any optionally followed by\
- U+003F (?) U+003F (?)\
- URL クエリ文字列 and a URL-query string.
注記: 相対 URL 文字列を URL 構文解析器にかけるときは、 基底 URL に null 以外を与えることが必要とされる。 A non-null base URL is necessary when parsing a relative-URL string.
スキーム相対特別 URL 文字列 は、 次の並びでなければならない: A scheme-relative-special-URL string must be\
-
"
//
" "//",\ - 妥当なホスト文字列 followed by a valid host string,\
-
省略可能な,次の並び: optionally followed by\
- U+003A (:) U+003A (:)\
- URL ポート文字列 and a URL-port string,\
- 省略可能な,パス絶対 URL 文字列 optionally followed by a path-absolute-URL string.
URL ポート文字列 は、 次のいずれかでなければならない: A URL-port string must be one of the following:
- 空文字列 the empty string
- 1 個以上の ASCII 数字たちが成す並びであって, 10 進数で 16 ビットな無符号整数を表現しているもの one or more ASCII digits representing a decimal number that is a 16-bit unsigned integer.
スキーム相対 URL 文字列 は、 次の並びでなければならない: A scheme-relative-URL string must be\
-
"
//
" "//",\ - 不透明なホスト&ポート文字列 followed by an opaque-host-and-port string,\
- 省略可能な,パス絶対 URL 文字列 optionally followed by a path-absolute-URL string.
不透明なホスト&ポート文字列 は、 次のいずれかでなければならない: An opaque-host-and-port string must be either\
- 空文字列 the empty string\
-
次の並び: or:\
- 妥当な不透明なホスト文字列 a valid opaque-host string,\
-
省略可能な,次の並び: optionally followed by\
- U+003A (:) U+003A (:)\
- URL ポート文字列 and a URL-port string.
スキーム相対 file URL 文字列 は、 次の並びでなければならない: A scheme-relative-file-URL string must be\
-
"
//
" "//", followed by\ -
次のいずれか: one of the following:
-
次の並び:
a valid host string, optionally followed by a path-absolute-non-Windows-file-URL string - パス絶対 URL 文字列 a path-absolute-URL string.
-
パス絶対 URL 文字列 は、 次の並びでなければならない: A path-absolute-URL string must be\
- U+002F (/) U+002F (/)\
- パス相対 URL 文字列 followed by a path-relative-URL string.
パス絶対 非 Windows file URL 文字列 は、 ∧↓ を満たす文字列でなければならない: A path-absolute-non-Windows-file-URL string must be\
- パス絶対 URL 文字列である a path-absolute-URL string\
-
次の並びから開始していない: that does not start with:\
- U+002F (/) U+002F (/),\
- Windows ドライブレター followed by a Windows drive letter,\
- U+002F (/) followed by U+002F (/).
パス相対 URL 文字列 は、 ∧↓ を満たす文字列でなければならない: A path-relative-URL string must be\
- U+002F (/) で分離された[ 0 個以上の URL パス区分文字列 ]からなる zero or more URL-path-segment strings, separated from each other by U+002F (/), and\
- U+002F (/) から開始していない not start with U+002F (/).
パス相対 スキームなし URL 文字列 は、 ∧↓ を満たす文字列でなければならない: A path-relative-scheme-less-URL string must be\
- パス相対 URL 文字列である a path-relative-URL string\
-
次の並びから開始していない: that does not start with:\
- URL スキーム文字列 a URL-scheme string,\
- U+003A (:) followed by U+003A (:).
URL パス区分文字列 は、 0 個以上の[ U+002F (/), U+003F (?) 以外の URL 単位 ]たちが成す並びでなければならない。 A URL-path-segment string must be one of the following: • zero or more URL units excluding U+002F (/) and U+003F (?), that together are not a single-dot URL path segment or a double-dot URL path segment.
特に,[ 二重ドット URL パス区分/単ドット URL パス区分 ]は、 URL パス区分文字列である。 • a single-dot URL path segment • a double-dot URL path segment.
【 似た名前の URL パス区分は、 ASCII 文字列に限定される。 】
URL クエリ文字列 は、[ 0 個以上の URL 単位たちが成す並び ]でなければならない。 A URL-query string must be zero or more URL units.
URL 素片文字列 は、[ 0 個以上の URL 単位たちが成す並び ]でなければならない。 A URL-fragment string must be zero or more URL units.
次に挙げる符号位置が URL 符号位置 である: The URL code points are\
- ASCII 英数字 ASCII alphanumeric,\
- U+0021 (!), U+0024 ($), U+0026 (&), U+0027 ('), U+0028 ((), U+0029 ()), U+002A (*), U+002B (+), U+002C (,), U+002D (-), U+002E (.), U+002F (/), U+003A (:), U+003B (;), U+003D (=), U+003F (?), U+0040 (@), U+005F (_), U+007E (~) U+0021 (!), U+0024 ($), U+0026 (&), U+0027 ('), U+0028 LEFT PARENTHESIS, U+0029 RIGHT PARENTHESIS, U+002A (*), U+002B (+), U+002C (,), U+002D (-), U+002E (.), U+002F (/), U+003A (:), U+003B (;), U+003D (=), U+003F (?), U+0040 (@), U+005F (_), U+007E (~),\
- U+00A0 〜 U+10FFFD — ただし、 サロゲート, 非文字は除外する。 and code points in the range U+00A0 to U+10FFFD, inclusive, excluding surrogates and noncharacters.
注記: U+0080 以上の符号位置は、 URL 構文解析器により %-符号化されたバイトに変換されることになる。 Code points greater than U+007F DELETE will be converted to percent-encoded bytes by the URL parser.
注記: HTML においては、 文書の符号化法が旧来のものである場合、 URL クエリ文字列内の U+0080 以上の符号位置は, 文書の符号化法を利用して %-符号化されたバイトに変換される。 これは、 ある文書で働く URL が 異なる文書符号化法を利用する文書に複製されるときに, 問題になり得る。 この問題は、 あらゆる箇所に UTF-8 符号化法を利用すれば解消する。 In HTML, when the document encoding is a legacy encoding, code points in the URL-query string that are higher than U+007F DELETE will be converted to percent-encoded bytes using the document’s encoding. This can cause problems if a URL that works in one document is copied to another document that uses a different document encoding. Using the UTF-8 encoding everywhere solves this problem.
例えば、 次の HTML 文書を考える: For example, consider this HTML document:
<!doctype html> <meta charset="windows-1252"> <a href="?smörgåsbord">Test</a>
文書符号化法は windows-1252 なので、
リンクの URL のクエリは
"sm%F6rg%E5sbord
"
になる。
文書符号化法が UTF-8 であった場合、
それは
"sm%C3%B6rg%C3%A5sbord
"
になる。
Since the document encoding is windows-1252, the link’s URL’s query will be "sm%F6rg%E5sbord". If the document encoding had been UTF-8, it would instead be "sm%C3%B6rg%C3%A5sbord".
次に挙げるものが URL 単位 である :URL 符号位置, %-符号化されたバイト The URL units are URL code points and percent-encoded bytes.
【 したがって、 URL 単位は,一般には( 1 個の符号位置に限られない)文字列である。 】
注記: %-符号化されたバイトは、 符号位置のうち[ URL 符号位置でない, あるいは 書き出せるものから除外されている ]ものを符号化するときに,利用され得る/できる。 Percent-encoded bytes can be used to encode code points that are not URL code points or are excluded from being written.
注記: 妥当な URL 文字列の中で,URL レコードの[ ユーザ名, パスワード ]を表出する仕方は無い。 There is no way to express a username or password of a URL record within a valid URL string.
4.4. URL の構文解析法
URL 構文解析する アルゴリズムは( “URL 構文解析器にかける” とも称される)、 所与の :スカラー値文字列 入力, [ null /基底 URL ] 基底 (省略時は null ), 符号化法 符号化法 (省略時は UTF-8 ) に対し: The URL parser takes a scalar value string input, with an optional null or base URL base (default null) and an optional encoding encoding (default UTF-8), and then runs these steps:
注記: 非 web ブラウザ実装は、 基本 URL 構文解析器のみ実装すれば十分である。 Non-web-browser implementations only need to implement the basic URL parser.
注記: ブラウザの URL バー内の利用者入力を URL レコードに どう変換するかは、 この標準の視野から外れる。 この標準は、 URL の具現化要件を — 信用裁定に係るので — 含むが。 How user input in the web browser’s address bar is converted to a URL record is out-of-scope of this standard. This standard does include URL rendering requirements as they pertain trust decisions.
- URL :← 基本 URL 構文解析器( 入力, 基底, 符号化法 ) Let url be the result of running the basic URL parser on input with base and encoding.
- IF[ URL = 失敗 ] :RETURN 失敗 If url is failure, return failure.
-
IF[
URL のスキーム ≠ "
blob
" ] :RETURN URL If url’s scheme is not "blob", return url. - URL の blob URL エントリ ← 次の結果に応じて[ 失敗 ならば null / 他の場合は その結果 ] :blob URL を解決する( URL ) Set url’s blob URL entry to the result of resolving the blob URL url, if that did not return failure, and null otherwise.
- RETURN URL Return url.
API 用に URL 構文解析する アルゴリズムは、 所与の :スカラー値文字列 入力, URL URL , 上書き state , 符号化法 符号化法 (省略時は UTF-8 ) に対し :基本 URL 構文解析器( 入力, null , 符号化法, ( URL , 上書き state ) ) 加えて、 結果に応じて,次を返す :失敗 ならば 失敗 / 他の場合は(基本 URL 構文解析器は値を返さなかった) 成功
【 このアルゴリズムは,基本 URL 構文解析器を包装するものでしかないが、 それを他所(他の仕様も含む)から簡便に利用するために, この訳に導入している。 これは、 主として, URL 内の 上書き state に対応する URL 成分 (例:ホスト state ならばホスト成分) を[ 入力 を その成分に関して構文解析した結果 ]に改変する用途が意図される (新たな URL は作成しない)。 ( “API 用…” と命名された理由は、 下の注記を見よ。) 】
基本 URL 構文解析器 は、 所与の :スカラー値文字列 入力, [ null /基底 URL ] 基底 (省略時は null ), 符号化法 符号化法 (省略時は UTF-8 ), URL と上書き state が成すペア ( URL , 上書き state ) (省略時は ( ε, ε ) ) に対し: The basic URL parser takes a scalar value string input, with an optional null or base URL base (default null), an optional encoding encoding (default UTF-8), an optional URL url, and an optional state override state override, and then runs these steps:
注記:
- 引数 符号化法 は、 HTML に限り関連する,旧来の概念である。 [HTML] The encoding argument is a legacy concept only relevant for HTML.\
-
( URL , 上書き state ) が利用されるのは、 各種 API に限られる†。 基本 URL 構文解析器は、 このペアが :渡されなかった場合、 URL または 失敗 を返す/ 渡された場合、[渡された URL を改変して何も返さずに終了する]こともある††
【† すなわち、 API 用に URL 構文解析するを介して呼び出された場合。 】【†† あるいは 失敗 を返す。 その場合、 URL は改変されないべきだが,明示的に そう述べられてはいない — アルゴリズムを精査する必要がある。 】
The url and state override arguments are only for use by various APIs. [HTML]When the url and state override arguments are not passed, the basic URL parser returns either a new URL or failure. If they are passed, the algorithm modifies the passed url and can terminate without returning anything.
-
IF[ URL = ε ]: If url is not given:
- URL ← 新たな URL Set url to a new URL.
- IF[ 入力 の[ 先頭または末尾 ]の文字 ∈ C0 制御文字やスペース ] :検証エラー( invalid-URL-unit ) If input contains any leading or trailing C0 control or space, invalid-URL-unit validation error.
- 入力 から[ 頭部, 尾部 ]を成す[ C0 制御文字やスペースたちが成す並び ]を除去する Remove any leading and trailing C0 control or space from input.
- IF[ 入力 内に ASCII タブや ASCII 改行文字が在る ] :検証エラー( invalid-URL-unit ) If input contains any ASCII tab or newline, invalid-URL-unit validation error.
- 入力 からすべての ASCII タブや ASCII 改行文字を除去する Remove all ASCII tab or newline from input.
- state :← [ 上書き state ≠ ε ならば 上書き state / 他の場合は スキーム開始 state ] Let state be state override if given, or scheme start state otherwise.
- 符号化法 ← 符号化法から出力符号化法を取得する( 符号化法 ) Set encoding to the result of getting an output encoding from encoding.
- バッファ :← 空文字列 Let buffer be the empty string.
- ( @マークありか, 角括弧の内側か, パスワードトークンありか ) :← ( false, false, false ) Let atSignSeen, insideBrackets, and passwordTokenSeen be false.
- ポインタ :← 入力 用のポインタ Let pointer be a pointer for input.
-
WHILE 無条件
Keep running the following state machine by switching on state. If after a run pointer points to the EOF code point, go to the next step. Otherwise, increase pointer by 1 and continue with the state machine. -
IF[ 上書き state = ε ] :RETURN URL
【 構文解析に失敗した場合、 この段には到達しない。 】【 この段は,原文では状態機械の後に置かれているが、 見通しを良くするため,ここに移動している。 】
↓↓
状態機械は、 state に応じて,以下における対応する段を走らす — この状態機械の中では: ↑↑
- “RETURN” は、 上のアルゴリズム自身を終了させるとする。
-
URL 単位かどうか検証する 所では、 C に応じて次を走らすとする:
- URL 符号位置 :何もしない
- U+0025 (%) :IF[ C1 ∉ ASCII 16 進数字 ]∨[ C2 ∉ ASCII 16 進数字 ] :検証エラー( invalid-URL-unit )
- その他 :検証エラー( invalid-URL-unit )
【 この定義は、 共通な記述を集約するために,この訳に導入している。 】
【 この状態機械は、 現在の state からは常に,自身または自身より後に示される state へ遷移するよう、 ソートして記されている。 】
- スキーム開始 state
-
- IF[ C ∈ ASCII 英字 ] :バッファ << ASCII 小文字化する( C ); state ← スキーム state If c is an ASCII alpha, append c, lowercased, to buffer, and set state to scheme state.
- ELSE IF[ 上書き state = ε ] :ポインタ −= 1; state ← スキームなし state Otherwise, if state override is not given, set state to no scheme state and decrease pointer by 1.
-
ELSE :RETURN 失敗 Otherwise, return failure.
この 失敗 の指示は、
Location
オブジェクトのprotocol
設定子から排他的に利用される。 This indication of failure is used exclusively by the Location object’s protocol setter.
- スキーム state
-
- IF[ C は ASCII 英数字である ]∨[ C ∈ { U+002B (+), U+002D (-), U+002E (.) } ] :バッファ << ASCII 小文字化する( C ) If c is an ASCII alphanumeric, U+002B (+), U+002D (-), or U+002E (.), append c, lowercased, to buffer.
-
ELSE IF[ C = U+003A (:) ]: Otherwise, if c is U+003A (:), then:
-
IF[ 上書き state ≠ ε ]∧[ ∨↓ ]… If state override is given, then:
- [ URL のスキーム, バッファ ]のうち,片方だけが特別スキームである If url’s scheme is a special scheme and buffer is not a special scheme, then return.If url’s scheme is not a special scheme and buffer is a special scheme, then return.
-
[[
URL は資格情報を含んでいる
]∨[
URL のポート ≠ null
]]∧[
バッファ = "
file
" ] If url includes credentials or has a non-null port, and buffer is "file", then return. -
[
URL のスキーム = "
file
" ]∧[ URL のホストは空ホストである ] If url’s scheme is "file" and its host is an empty host, then return.
…ならば :RETURN ↑
- URL のスキーム ← バッファ Set url’s scheme to buffer.
-
IF[ 上書き state ≠ ε ]: If state override is given, then:
- バッファ ← 空文字列 Set buffer to the empty string.
-
IF[ URL のスキーム = "
file
" ]: If url’s scheme is "file", then:-
IF[
C1 ≠ "
/
" ]∨[ C2 ≠ "/
" ] :検証エラー( special-scheme-missing-following-solidus ) If remaining does not start with "//", special-scheme-missing-following-solidus validation error. - state ← file state Set state to file state.
-
IF[
C1 ≠ "
-
ELSE IF[ URL は特別である ]∧[ 基底 ≠ null ]∧[ 基底 のスキーム = URL のスキーム ]: Otherwise, if url is special, base is non-null, and base’s scheme is url’s scheme:
- Assert: 基底 は特別である (したがって,不透明なパスを有さない)。 Assert: base is special (and therefore does not have an opaque path).
- 状態 ← 特別 相対/権限 state Set state to special relative or authority state.
- ELSE IF[ URL は特別である ] :state ← 特別 権限スラッシュ state Otherwise, if url is special, set state to special authority slashes state.
- ELSE IF[ C1 = U+002F (/) ] :ポインタ += 1; state ← パス/権限 state Otherwise, if remaining starts with an U+002F (/), set state to path or authority state and increase pointer by 1.
- ELSE :URL のパス ← 空文字列; state ← 不透明パス state Otherwise, set url’s path to the empty string and set state to opaque path state.
-
- ELSE IF[ 上書き state = ε ] :バッファ ← 空文字列; ポインタ ← −1 (入力 の最初の符号位置から、やり直す); state ← スキームなし state; Otherwise, if state override is not given, set buffer to the empty string, state to no scheme state, and start over (from the first code point in input).
-
ELSE :RETURN 失敗 Otherwise, return failure.
この 失敗 の指示は、
Location
オブジェクトのprotocol
設定子から排他的に利用される。 更には,この state の早期における非 失敗 による終了は、 その設定子を定義するための意図的な相違である。 This indication of failure is used exclusively by the Location object’s protocol setter. Furthermore, the non-failure termination earlier in this state is an intentional difference for defining that setter.
- スキームなし state
-
- IF[ 基底 = null ]∨[[ 基底 は不透明なパスを有する ]∧[ C ≠ U+0023 (#) ]] :検証エラー( missing-scheme-non-relative-URL ); RETURN 失敗 If base is null, or base has an opaque path and c is not U+0023 (#), missing-scheme-non-relative-URL validation error, return failure.
-
ELSE IF[ 基底 は不透明なパスを有する ]∧[ C = U+0023 (#) ]:
Otherwise, if base has an opaque path and c is U+0023 (#), set url’s scheme to base’s scheme, url’s path to base’s path, url’s query to base’s query, url’s fragment to the empty string, and set state to fragment state. -
ELSE IF[
基底 のスキーム ≠ "
file
" ] :ポインタ −= 1; state ← 相対 state Otherwise, if base’s scheme is not "file", set state to relative state and decrease pointer by 1. - ELSE :ポインタ −= 1; state ← file state Otherwise, set state to file state and decrease pointer by 1.
- 特別 相対/権限 state
-
- IF[ C = U+002F (/) ]∧[ C1 = U+002F (/) ] :ポインタ += 1; state ← 特別 権限スラッシュ無視 state If c is U+002F (/) and remaining starts with U+002F (/), then set state to special authority ignore slashes state and increase pointer by 1.
- ELSE :検証エラー( special-scheme-missing-following-solidus ); ポインタ −= 1; state ← 相対 state Otherwise, special-scheme-missing-following-solidus validation error, set state to relative state and decrease pointer by 1.
- パス/権限 state
- 相対 state
-
-
Assert:
基底 のスキーム ≠ "
file
" Assert: base’s scheme is not "file". - URL のスキーム ← 基底 のスキーム Set url’s scheme to base’s scheme.
- IF[ C = U+002F (/) ] :state ← 相対スラッシュ state If c is U+002F (/), then set state to relative slash state.
- ELSE IF[ URL は特別である ]∧[ C = U+005C (\) ] :検証エラー( invalid-reverse-solidus ); state ← 相対スラッシュ state Otherwise, if url is special and c is U+005C (\), invalid-reverse-solidus validation error, set state to relative slash state.
-
ELSE: Otherwise:
- URL の :ユーザ名 ← 基底 のユーザ名; パスワード ← 基底 のパスワード; ホスト ← 基底 のホスト; ポート ← 基底 のポート; パス ← 基底 のパスをクローンする; クエリ ← 基底 のクエリ Set url’s username to base’s username, url’s password to base’s password, url’s host to base’s host, url’s port to base’s port, url’s path to a clone of base’s path, and url’s query to base’s query.
- IF[ C = U+003F (?) ] :URL のクエリ ← 空文字列; state ← クエリ state If c is U+003F (?), then set url’s query to the empty string, and state to query state.
- ELSE IF[ C = U+0023 (#) ] :URL の素片 ← 空文字列; state ← 素片 state Otherwise, if c is U+0023 (#), set url’s fragment to the empty string and state to fragment state.
-
ELSE IF[ C ≠ EOF ]: Otherwise, if c is not the EOF code point:
-
Assert:
基底 のスキーム ≠ "
- 相対スラッシュ state
-
-
IF[ URL は特別である ]∧[ C ∈ { U+002F (/), U+005C (\) } ]: If url is special and c is U+002F (/) or U+005C (\), then:
- IF[ C = U+005C (\) ] :検証エラー( invalid-reverse-solidus ) If c is U+005C (\), invalid-reverse-solidus validation error.
- state ← 特別 権限スラッシュ無視 state Set state to special authority ignore slashes state.
- ELSE IF[ C = U+002F (/) ] :state ← 権限 state Otherwise, if c is U+002F (/), then set state to authority state.
-
ELSE:
Otherwise, set url’s username to base’s username, url’s password to base’s password, url’s host to base’s host, url’s port to base’s port, state to path state, and then, decrease pointer by 1.
-
- 特別 権限スラッシュ state
-
- IF[ C = U+002F (/) ]∧[ C1 = U+002F (/) ] :ポインタ += 1 If c is U+002F (/) and remaining starts with U+002F (/), then set state to special authority ignore slashes state and increase pointer by 1.
- ELSE :検証エラー( special-scheme-missing-following-solidus ); ポインタ −= 1 Otherwise, special-scheme-missing-following-solidus validation error, set state to special authority ignore slashes state and decrease pointer by 1.
- state ← 特別 権限スラッシュ無視 state ↑
- 特別 権限スラッシュ無視 state
-
- IF[ C ∉ { U+002F (/), U+005C (\) } ] :ポインタ −= 1; state ← 権限 state If c is neither U+002F (/) nor U+005C (\), then set state to authority state and decrease pointer by 1.
- ELSE :検証エラー( special-scheme-missing-following-solidus ) Otherwise, special-scheme-missing-following-solidus validation error.
- 権限 state
-
-
IF[ C = U+0040 (@) ]: If c is U+0040 (@), then:
- 検証エラー( invalid-credentials ) Invalid-credentials validation error.
-
IF[
@マークありか = true
]
:バッファ の先頭に "
%40
" を挿入する If atSignSeen is true, then prepend "%40" to buffer. - @マークありか ← true Set atSignSeen to true.
-
バッファ を成す 各( 符号位置 ) に対し: For each codePoint in buffer:
- IF[ 符号位置 = U+003A (:) ]∧[ パスワードトークンありか = false ] :パスワードトークンありか ← true; CONTINUE If codePoint is U+003A (:) and passwordTokenSeen is false, then set passwordTokenSeen to true and continue.
- 符号化済み符号位置 :← 符号位置を UTF-8 %-符号化する( 符号位置, ユーザ情報 %-符号化集合 ) Let encodedCodePoints be the result of running UTF-8 percent-encode codePoint using the userinfo percent-encode set.
- IF[ パスワードトークンありか = true ] :URL のパスワード << 符号化済み符号位置 If passwordTokenSeen is true, then append encodedCodePoints to url’s password.
- ELSE :URL のユーザ名 << 符号化済み符号位置 Otherwise, append encodedCodePoints to url’s username.
- バッファ ← 空文字列 Set buffer to the empty string.
-
ELSE IF[ ∨↓ ]… Otherwise, if one of the following is true:
- C ∈ { EOF, U+002F (/), U+003F (?), U+0023 (#) } c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
- [ URL は特別である ]∧[ C = U+005C (\) ] url is special and c is U+005C (\)
…ならば: then:
- IF[ @マークありか = true ]∧[ バッファ = 空文字列 ] :検証エラー( host-missing ); RETURN 失敗 If atSignSeen is true and buffer is the empty string, host-missing validation error, return failure.
- ポインタ −= バッファ の符号位置長さ + 1 Decrease pointer by buffer’s code point length + 1,\
- バッファ ← 空文字列 set buffer to the empty string,\
- state ← ホスト state and set state to host state.
- ELSE :バッファ << C Otherwise, append c to buffer.
-
- ホスト state
- ホスト名 state
-
-
IF[
上書き state ≠ ε
]∧[
URL のスキーム = "
file
" ] :ポインタ −= 1; state ← file ホスト state If state override is given and url’s scheme is "file", then decrease pointer by 1 and set state to file host state. -
ELSE IF[ C = U+003A (:) ]∧[ 角括弧の内側か = false ]: Otherwise, if c is U+003A (:) and insideBrackets is false:
- IF[ バッファ = 空文字列 ] :検証エラー( host-missing ); RETURN 失敗 If buffer is the empty string, host-missing validation error, return failure.
- IF[ 上書き state = ホスト名 state ] :RETURN 失敗 If state override is given and state override is hostname state, then return failure.
- ホスト :← ホスト構文解析器( バッファ, IS[ URL は特別でない] ) Let host be the result of host parsing buffer with url is not special.
- IF[ ホスト = 失敗 ] :RETURN 失敗 If host is failure, then return failure.
- URL のホスト ← ホスト Set url’s host to host,\
- バッファ ← 空文字列 buffer to the empty string,\
- state ← ポート state and state to port state.
-
ELSE IF[ ∨↓ ]… Otherwise, if one of the following is true:
- C ∈ { EOF, U+002F (/), U+003F (?), U+0023 (#) } c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#)
- [ URL は特別である ]∧[ C = U+005C (\) ] url is special and c is U+005C (\)
…ならば: then decrease pointer by 1, and:
- ポインタ −= 1 ↑
- IF[ URL は特別である ]∧[ バッファ = 空文字列 ] :検証エラー( host-missing ); RETURN 失敗 If url is special and buffer is the empty string, host-missing validation error, return failure.
- ELSE IF[ 上書き state ≠ ε ]∧[ バッファ = 空文字列 ]∧[[ URL は資格情報を含んでいる ]∨[ URL のポート ≠ null ]] :RETURN 失敗 Otherwise, if state override is given, buffer is the empty string, and either url includes credentials or url’s port is non-null, then return failure.
- ホスト :← ホスト構文解析器( バッファ, IS[ URL は特別でない] ) Let host be the result of host parsing buffer with url is not special.
- IF[ ホスト = 失敗 ] :RETURN 失敗 If host is failure, then return failure.
- URL のホスト ← ホスト Set url’s host to host, buffer to the empty string, and state to path start state.
- IF[ 上書き state ≠ ε ] :RETURN If state override is given, then return.
- バッファ ← 空文字列 ↑
- state ← パス開始 state ↑
-
ELSE: Otherwise:
-
IF[
上書き state ≠ ε
]∧[
URL のスキーム = "
- ポート state
-
- IF[ C ∈ ASCII 数字 ] :バッファ << C If c is an ASCII digit, append c to buffer.
-
ELSE IF[ ∨↓ ]… Otherwise, if one of the following is true:
- C ∈ { EOF, U+002F (/), U+003F (?), U+0023 (#) } c is the EOF code point, U+002F (/), U+003F (?), or U+0023 (#);
- [ URL は特別である ]∧[ C = U+005C (\) ] url is special and c is U+005C (\); or
- 上書き state ≠ ε state override is given,
…ならば: then:
-
IF[ バッファ ≠ 空文字列 ]: If buffer is not the empty string:
- ポート :← バッファ を[ その各 ASCII 数字を基数 10 による値 0 〜 9 と解釈した ]下で表現される,数学的な整数値 Let port be the mathematical integer value that is represented by buffer in radix-10 using ASCII digits for digits with values 0 through 9.
- IF[ ポート は 16 ビットな無符号整数でない ] :検証エラー( port-out-of-range ); RETURN 失敗 If port is not a 16-bit unsigned integer, port-out-of-range validation error, return failure.
- URL のポート ← [ 次が満たされるならば null / 他の場合は ポート ] :ポート = URL のスキームの既定ポート Set url’s port to null, if port is url’s scheme’s default port; otherwise to port.
- バッファ ← 空文字列 Set buffer to the empty string.
- IF[ 上書き state ≠ ε ] :RETURN If state override is given, then return.
- IF[ 上書き state ≠ ε ] :RETURN 失敗 If state override is given, then return failure.
- ポインタ −= 1 ↓
- state ← パス開始 state Set state to path start state and decrease pointer by 1.
- ELSE :検証エラー( port-invalid ); RETURN 失敗 Otherwise, port-invalid validation error, return failure.
- file state
-
-
URL のスキーム ← "
file
" Set url’s scheme to "file". - URL のホスト ← 空文字列 Set url’s host to the empty string.
-
IF[ C ∈ { U+002F (/), U+005C (\) } ]: If c is U+002F (/) or U+005C (\), then:
- IF[ C = U+005C (\) ] :検証エラー( invalid-reverse-solidus ) If c is U+005C (\), invalid-reverse-solidus validation error.
- state ← file スラッシュ state Set state to file slash state.
-
ELSE IF[ 基底 ≠ null ]∧[ 基底 のスキーム = "
file
" ]: Otherwise, if base is non-null and base’s scheme is "file":- URL の :ホスト ← 基底 のホスト; パス ← 基底 のパスをクローンする; クエリ ← 基底 のクエリ Set url’s host to base’s host, url’s path to a clone of base’s path, and url’s query to base’s query.
- IF[ C = U+003F (?) ] :URL のクエリ ← 空文字列; state ← クエリ state If c is U+003F (?), then set url’s query to the empty string and state to query state.
- ELSE IF[ C = U+0023 (#) :URL の素片 ← 空文字列; state ← 素片 state Otherwise, if c is U+0023 (#), set url’s fragment to the empty string and state to fragment state.
-
ELSE IF[ C ≠ EOF ]: Otherwise, if c is not the EOF code point:
- URL のクエリ ← null Set url’s query to null.
- IF[ 並び[ C, C1, C2 ]は Windows ドライブレターから開始していない ] :URL のパスを短縮する If the code point substring from pointer to the end of input does not start with a Windows drive letter, then shorten url’s path.
-
ELSE :検証エラー( file-invalid-Windows-drive-letter ); URL のパス ← « » Otherwise: • File-invalid-Windows-drive-letter validation error. • Set url’s path to « ».
注記: これは、 Windows ドライブレター用の(プラットフォームに依存しない)過去互換対処である。 This is a (platform-independent) Windows drive letter quirk.
- ポインタ −= 1; ↓
- state ← パス state Set state to path state and decrease pointer by 1.
- ELSE :ポインタ −= 1; state ← パス state Otherwise, set state to path state, and decrease pointer by 1.
-
URL のスキーム ← "
- file スラッシュ state
-
-
IF[ C ∈ { U+002F (/), U+005C (\) } ]: If c is U+002F (/) or U+005C (\), then:
- IF[ C = U+005C (\) ] :検証エラー( invalid-reverse-solidus ) If c is U+005C (\), invalid-reverse-solidus validation error.
- state ← file ホスト state Set state to file host state.
-
ELSE: Otherwise:
-
IF[ 基底 ≠ null ]∧[ 基底 のスキーム = "
file
" ]: If base is non-null and base’s scheme is "file", then:- URL のホスト ← 基底 のホスト Set url’s host to base’s host.
-
IF[ 並び[ C, C1, C2 ]は Windows ドライブレターから開始していない ]∧[[ 基底 のパス[ 0 ] ]は正規化済み Windows ドライブレターである ] :URL のパスに[ 基底 のパス[ 0 ] ]を付加する If the code point substring from pointer to the end of input does not start with a Windows drive letter and base’s path[0] is a normalized Windows drive letter, then append base’s path[0] to url’s path.
注記: これは、 Windows ドライブレター用の(プラットフォームに依存しない)過去互換対処である。 This is a (platform-independent) Windows drive letter quirk.
- ポインタ −= 1 ↓
- state ← パス state Set state to path state, and decrease pointer by 1.
-
-
- file ホスト state
-
-
IF[ C ∈ { EOF, U+002F (/), U+005C (\), U+003F (?), U+0023 (#) } ]: If c is the EOF code point, U+002F (/), U+005C (\), U+003F (?), or U+0023 (#), then\
- ポインタ −= 1 decrease pointer by 1 and then:\
-
IF[ 上書き state = ε ]∧[ バッファ は Windows ドライブレターである ] :検証エラー( file-invalid-Windows-drive-letter-host ); state ← パス state If state override is not given and buffer is a Windows drive letter, file-invalid-Windows-drive-letter-host validation error, set state to path state.
注記: これは、 Windows ドライブレター用の(プラットフォームに依存しない)過去互換対処である。 ここでは バッファ は設定し直されず,代わりにパス stateの中で利用される。 This is a (platform-independent) Windows drive letter quirk. buffer is not reset here and instead used in the path state.
-
ELSE IF[ バッファ = 空文字列 ]: Otherwise, if buffer is the empty string, then:
- URL のホスト ← 空文字列 Set url’s host to the empty string.
- IF[ 上書き state ≠ ε ] :RETURN If state override is given, then return.
- state ← パス開始 state Set state to path start state.
-
ELSE: Otherwise, run these steps:
- ホスト :← ホスト構文解析器( バッファ, IS[ URL は特別でない] ) Let host be the result of host parsing buffer with url is not special.
- IF[ ホスト = 失敗 ] :RETURN 失敗 If host is failure, then return failure.
-
IF[
ホスト = "
localhost
" ] :ホスト ← 空文字列 If host is "localhost", then set host to the empty string. - URL のホスト ← ホスト Set url’s host to host.
- IF[ 上書き state ≠ ε ] :RETURN If state override is given, then return.
- バッファ ← 空文字列 Set buffer to the empty string and\
- state ← パス開始 state state to path start state.
- ELSE :バッファ << C Otherwise, append c to buffer.
-
- パス開始 state
-
-
IF[ URL は特別である ]: If url is special, then:
- IF[ C = U+005C (\) ] :検証エラー( invalid-reverse-solidus ) If c is U+005C (\), invalid-reverse-solidus validation error.
- IF[ C ∉ { U+002F (/), U+005C (\) } ] :ポインタ −= 1 Set state to path state.If c is neither U+002F (/) nor U+005C (\), then decrease pointer by 1.
- state ← パス state ↑
- ELSE IF[ 上書き state = ε ]∧[ C = U+003F (?) ] :URL のクエリ ← 空文字列; state ← クエリ state Otherwise, if state override is not given and c is U+003F (?), set url’s query to the empty string and state to query state.
- ELSE IF[ 上書き state = ε ]∧[ C = U+0023 (#) ] :URL の素片 ← 空文字列; state ← 素片 state Otherwise, if state override is not given and c is U+0023 (#), set url’s fragment to the empty string and state to fragment state.
-
ELSE IF[ C ≠ EOF ]: Otherwise, if c is not the EOF code point:
- ELSE IF[ 上書き state ≠ ε ]∧[ URL のホスト = null ] :URL のパスに空文字列を付加する Otherwise, if state override is given and url’s host is null, append the empty string to url’s path.
-
- パス state
-
- スラッシュか :← IS[ C = U+002F (/) ]∨[[ URL は特別である ]∧[ C = U+005C (\) ]] ↓
-
IF[ ∨↓ ]… If one of the following is true:
- C = EOF c is the EOF code point or U+002F (/) ↓
- スラッシュか = true url is special and c is U+005C (\)
- [ 上書き state = ε ]∧[ C ∈ { U+003F (?), U+0023 (#) } ]: state override is not given and c is U+003F (?) or U+0023 (#)
…ならば: then:
- IF[ URL は特別である ]∧[ C = U+005C (\) ] :検証エラー( invalid-reverse-solidus ) If url is special and c is U+005C (\), invalid-reverse-solidus validation error.
-
IF[ バッファ は二重ドット URL パス区分である ]: If buffer is a double-dot URL path segment, then:
- URL のパスを短縮する Shorten url’s path.
-
IF[ スラッシュか = false ] :URL のパスに空文字列を付加する If neither c is U+002F (/), nor url is special and c is U+005C (\), append the empty string to url’s path.
注記: これは、 入力が "
/usr/..
" なら,結果は "/
" になり, パスが無くなるわけではないことを意味する。 This means that for input /usr/.. the result is / and not a lack of a path.
- ELSE IF[ バッファ は単ドット URL パス区分である ] :IF[ スラッシュか = false ] :URL のパスに空文字列を付加する Otherwise, if buffer is a single-dot URL path segment and if neither c is U+002F (/), nor url is special and c is U+005C (\), append the empty string to url’s path.
-
ELSE: Otherwise, if buffer is not a single-dot URL path segment, then:
-
IF[ URL のスキーム = "
file
" ]∧[ URL のパスは空である ]∧[ バッファ は Windows ドライブレターである ] :バッファ の 2 個目の符号位置を U+003A (:) に置換する If url’s scheme is "file", url’s path is empty, and buffer is a Windows drive letter, then replace the second code point in buffer with U+003A (:).注記: これは、 Windows ドライブレター用の(プラットフォームに依存しない)過去互換対処である。 This is a (platform-independent) Windows drive letter quirk.
- URL のパスに バッファ を付加する Append buffer to url’s path.
-
- バッファ ← 空文字列 Set buffer to the empty string.
- IF[ C = U+003F (?) ] :URL のクエリ ← 空文字列; state ← クエリ state If c is U+003F (?), then set url’s query to the empty string and state to query state.
- IF[ C = U+0023 (#) ] :URL の素片 ← 空文字列; state ← 素片 state If c is U+0023 (#), then set url’s fragment to the empty string and state to fragment state.
-
ELSE: Otherwise, run these steps:
- URL 単位かどうか検証する If c is not a URL code point and not U+0025 (%), invalid-URL-unit validation error.If c is U+0025 (%) and remaining does not start with two ASCII hex digits, invalid-URL-unit validation error.
- バッファ << 符号位置を UTF-8 %-符号化する( C, パス %-符号化集合 ) UTF-8 percent-encode c using the path percent-encode set and append the result to buffer.
- 不透明パス state
-
- IF[ C = U+003F (?) ] :URL のクエリ ← 空文字列; state ← クエリ state If c is U+003F (?), then set url’s query to the empty string and state to query state.
- ELSE IF[ C = U+0023 (#) ] :URL の素片 ← 空文字列; state ← 素片 state Otherwise, if c is U+0023 (#), then set url’s fragment to the empty string and state to fragment state.
-
ELSE IF[ C = U+0020 SPACE ]: Otherwise, if c is U+0020 SPACE:
-
ELSE IF[ C ≠ EOF ]: Otherwise, if c is not the EOF code point:
- URL 単位かどうか検証する If c is not a URL code point and not U+0025 (%), invalid-URL-unit validation error.If c is U+0025 (%) and remaining does not start with two ASCII hex digits, invalid-URL-unit validation error.
- URL のパス << 符号位置を UTF-8 %-符号化する( C, C0 制御文字 %-符号化集合 ) UTF-8 percent-encode c using the C0 control percent-encode set and append the result to url’s path.
- クエリ state
-
-
IF[
URL は特別でない
]∨[
URL のスキーム ∈ { "
ws
", "wss
" } ] :符号化法 ← UTF-8 If encoding is not UTF-8 and one of the following is true: • url is not special • url’s scheme is "ws" or "wss"then set encoding to UTF-8. -
IF[ ∨↓ ]… If one of the following is true:
- [ 上書き state = ε ]∧[ C = U+0023 (#) ] state override is not given and c is U+0023 (#)
- C = EOF c is the EOF code point
…ならば: then:
- クエリ %-符号化集合 :← URL に応じて :特別であるならば 特別クエリ %-符号化集合 / 他の場合は クエリ %-符号化集合 Let queryPercentEncodeSet be the special-query percent-encode set if url is special; otherwise the query percent-encode set.
-
URL のクエリ << 次の結果 :文字列を符号化してから %-符号化する( 符号化法, バッファ, クエリ %-符号化集合 ) Percent-encode after encoding, with encoding, buffer, and queryPercentEncodeSet, and append the result to url’s query.
注記: ISO-2022-JP 符号化器がステートフルであることに因り、 この演算は符号位置ごとには呼び出せない。 This operation cannot be invoked code-point-for-code-point due to the stateful ISO-2022-JP encoder.
- バッファ ← 空文字列 Set buffer to the empty string.
- IF[ C = U+0023 (#) ] :URL の素片 ← 空文字列; state ← 素片 state If c is U+0023 (#), then set url’s fragment to the empty string and state to fragment state.
-
ELSE IF[ C ≠ EOF ]: Otherwise, if c is not the EOF code point:
- URL 単位かどうか検証する If c is not a URL code point and not U+0025 (%), invalid-URL-unit validation error.If c is U+0025 (%) and remaining does not start with two ASCII hex digits, invalid-URL-unit validation error.
- バッファ << C Append c to buffer.
-
IF[
URL は特別でない
]∨[
URL のスキーム ∈ { "
- 素片 state
-
-
IF[ C ≠ EOF ]: If c is not the EOF code point, then:
- URL 単位かどうか検証する If c is not a URL code point and not U+0025 (%), invalid-URL-unit validation error.If c is U+0025 (%) and remaining does not start with two ASCII hex digits, invalid-URL-unit validation error.
- URL の素片 << 符号位置を UTF-8 %-符号化する( C, 素片 %-符号化集合 ) UTF-8 percent-encode c using the fragment percent-encode set and append the result to url’s fragment.
-
↑↑Return url.
URL のユーザ名を設定する アルゴリズムは、 所与の ( URL URL , 文字列 ユーザ名 ) に対し :URL のユーザ名 ← 文字列を UTF-8 %-符号化する( ユーザ名, ユーザ情報 %-符号化集合 ) To set the username given a url and username, set url’s username to the result of running UTF-8 percent-encode on username using the userinfo percent-encode set.
URL のパスワードを設定する アルゴリズムは、 所与の ( URL URL , 文字列 パスワード ) に対し :URL のパスワード ← 文字列を UTF-8 %-符号化する( パスワード, ユーザ情報 %-符号化集合 ) To set the password given a url and password, set url’s password to the result of running UTF-8 percent-encode on password using the userinfo percent-encode set.
4.5. URL の直列化法
URL 直列化器 は、 所与の ( URL URL , 素片は除外するか ∈ { 素片は除外する, ε }(省略時は ε ) ) に対し,次を走らせた結果の ASCII 文字列を返す: The URL serializer takes a URL url, with an optional boolean exclude fragment (default false), and then runs these steps. They return an ASCII string.
- 出力 :← 空文字列 << URL のスキーム << U+003A (:) Let output be url’s scheme and U+003A (:) concatenated.
-
IF[ URL のホスト ≠ null ]: If url’s host is non-null:
-
出力 << "
//
" Append "//" to output. -
IF[ URL は資格情報を含んでいる ]: If url includes credentials, then:
- 出力 << ホストを直列化する( URL のホスト ) Append url’s host, serialized, to output.
- IF[ URL のポート ≠ null ] :出力 << U+003A (:) << 整数を直列化する( URL のポート ) If url’s port is non-null, append U+003A (:) followed by url’s port, serialized, to output.
-
出力 << "
-
IF[ URL のホスト = null ]∧[ URL は不透明なパスを有さない ]∧[ URL のパスのサイズ > 1 ]∧[ URL のパス[ 0 ] = 空文字列 ] :出力 << U+002F (/) << U+002E (.) If url’s host is null, url does not have an opaque path, url’s path’s size is greater than 1, and url’s path[0] is the empty string, then append U+002F (/) followed by U+002E (.) to output.
注記: これは、
web+demo:/.//not-a-host/
やweb+demo:/path/..//not-a-host/
を 構文解析してから 直列化した結果がweb+demo://not-a-host/
になるのを防止する(結果はweb+demo:/.//not-a-host/
になる)。 This prevents web+demo:/.//not-a-host/ or web+demo:/path/..//not-a-host/, when parsed and then serialized, from ending up as web+demo://not-a-host/ (they end up as web+demo:/.//not-a-host/). - 出力 << URL パスを直列化する( URL ) Append the result of URL path serializing url to output.
- IF[ URL のクエリ ≠ null ] :出力 << U+003F (?) << URL のクエリ If url’s query is non-null, append U+003F (?), followed by url’s query, to output.
- IF[ 素片は除外するか = ε ]∧[ URL の素片 ≠ null ] :出力 << U+0023 (#) << URL の素片 If exclude fragment is false and url’s fragment is non-null, then append U+0023 (#), followed by url’s fragment, to output.
- RETURN 出力 Return output.
4.6. URL の等価性
- (単に) 同等な URL であるとは、 次が満たされることをいう :URL を直列化する( A ) = URL を直列化する( B )
- 素片は除外する下で同等な URL であるとは、 次が満たされることをいう :URL を直列化する( A, 素片は除外する ) = URL を直列化する( B, 素片は除外する )
4.7. 生成元
注記: 必要な背景情報については、 HTML による生成元の定義を見よ。 [HTML] See origin’s definition in HTML for the necessary background information. [HTML]
URL URL の 生成元 は、 URL のスキームに応じて,次の手続きを走らせて返される生成元である: The origin of a URL url is the origin returned by running these steps, switching on url’s scheme:
- "
blob
" -
- IF[ URL の blob URL エントリ ≠ null ] :RETURN URL の blob URL エントリの環境の生成元 If url’s blob URL entry is non-null, then return url’s blob URL entry’s environment’s origin.
- パス URL :← 基本 URL 構文解析器( URL パスを直列化する( URL ) ) Let pathURL be the result of parsing the result of URL path serializing url.
- IF[ パス URL = 失敗 ] :RETURN 新たな不透明な生成元 If pathURL is failure, then return a new opaque origin.
-
IF[
パス URL のスキーム ∈ { "
http
", "https
", "file
" } ] :RETURN パス URL の生成元 If pathURL’s scheme is "http", "https", or "file", then return pathURL’s origin. - RETURN 新たな不透明な生成元 Return a new opaque origin.
-
"
blob:https://whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f
" の生成元は、 成分組生成元 ( "https
", "whatwg.org
", null , null ) になる。 The origin of blob:https://whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f is the tuple origin ("https", "whatwg.org", null, null). - "
ftp
" - "
http
" - "
https
" - "
ws
" - "
wss
" - RETURN 成分組生成元( URL のスキーム, URL のホスト, URL のポート, null ) Return the tuple origin (url’s scheme, url’s host, url’s port, null).
- "
file
" - あいにく、 これについては, 読者【 UA 開発者】の行使に委ねられる。 疑わしい場合は、 新たな不透明な生成元を返すこと。 Unfortunate as it is, this is left as an exercise to the reader. When in doubt, return a new opaque origin.
- その他
-
RETURN 新たな不透明な生成元 Return a new opaque origin.
注記: これは実際に、 この種の URL は,自身と同一生成元になり得ないことを意味する。 【毎回,異なる結果が返されるので。】 This does indeed mean that these URLs cannot be same origin with themselves.
4.8. URL の具現化法
URL を表示する目的が,主として[ セキュリティや信用に関する裁定を利用者が為すこと ]にあるときは、[ URL 直列化器にかけた形 ]に以下に述べる改変を加えた上で具現化するべきである。 例えば、 利用者は[ URL バー内に具現化された URL ]に基いて[ 信用に関する裁定を為す ]ものと予期される。 A URL should be rendered in its serialized form, with modifications described below, when the primary purpose of displaying a URL is to have the user make a security or trust decision. For example, users are expected to make trust decisions based on a URL rendered in the browser address bar.
【 “具現化( rendering )” には、 描画に限らず,音声化なども含まれる — それらの取り扱いには多少異なる所もあろうが,同様な趣旨に従うことになる。 】
4.8.1. 人が読めない/関連しない成分を単純化する
セキュリティに関連する情報に対し[ 偽装する/気をそらす ]機会を供し得る成分を除去する — ブラウザは: Remove components that can provide opportunities for spoofing or distract from security-relevant information:
-
[
末端利用者が,ホストと URL を成す他の各部(パスなど)とを判別できる
]ことが重要になる所では、
URL のホストのみを具現化してもよい。
登録可能なドメインに注目を引くよう,ホストを更に単純化することを考慮してもよい。
例えば、
頭部を成すドメインラベル[
www
やm
]を省略して,ホストを単純化してもよい。 あるいは,その登録可能なドメインのみを表示して、 下位ドメイン (例:https://examplecorp.attacker.com/
) による偽装機会を除去してもよい。 Browsers may render only a URL’s host in places where it is important for end users to distinguish between the host and other parts of the URL such as the path. Browsers may consider simplifying the host further to draw attention to its registrable domain. For example, browsers may omit a leading www or m domain label to simplify the host, or display its registrable domain only to remove spoofing opportunities posted by subdomains (e.g., https://examplecorp.attacker.com/). -
URL の[
ユーザ名, パスワード
]を具現化するべきでない
— それらは URL のホストに誤認され得るので
(例:
https://examplecorp.com@attacker.example/
)。 Browsers should not render a URL’s username and password, as they can be mistaken for a URL’s host (e.g., https://examplecorp.com@attacker.example/). -
URL をスキームを伴わずに具現化してもよい
— そのような表示を単独のスキームに限り許可している場合には
(セキュアな生成元用に限り可能化される,
https://
を省略するブラウザ特能など)。 他の場合、 スキームを[ 人が読める文字列(例: “セキュアでない” ) やセキュリティ指示子アイコン, これら両者 ]で置換したり補足してもよい。 Browsers may render a URL without its scheme if the display surface only ever permits a single scheme (such as a browser feature that omits https:// because it is only enabled for secure origins). Otherwise, the scheme may be replaced or supplemented with a human-readable string (e.g., "Not secure"), a security indicator icon, or both.
4.8.2. URL を省くとき
表示が狭いときに URL の一部を省くときは、[ 利用者がセキュリティに関する裁定を為すときに,誤りへ導くこと ]を注意深く避けるべきである — ブラウザは: In a space-constrained display, URLs should be elided carefully to avoid misleading the user when making a security decision:
-
URL を具現化するときは、
少なくとも登録可能なドメインは示されることを確保するべきである
(例:
https://not-really-examplecorp.com/
を読み込むとき,...examplecorp.com
と示されるのを避けるため)。 Browsers should ensure that at least the registrable domain can be shown when the URL is rendered (to avoid showing, e.g., ...examplecorp.com when loading https://not-really-examplecorp.com/). -
全部的なホストを具現化できないときは、
ドメインラベル群を最低レベルのものから省くべきである。
例えば
examplecorp.com.evil.com
は、examplecorp.com...
ではなく,...com.evil.com
のように省くべきである (双方向テキストの場合、 最低レベルのドメインラベルは左端に現れないこともあることに注意)。 When the full host cannot be rendered, browsers should elide domain labels starting from the lowest-level domain label. For example, examplecorp.com.evil.com should be elided as ...com.evil.com, not examplecorp.com.... (Note that bidirectional text means that the lowest-level domain label may not appear on the left.)
4.8.3. 国際化と特殊文字
[ 国際化ドメイン名( IDN ), 特殊文字, 双方向テキスト ]は、 偽装を防止するよう注意して取り扱うべきである — ブラウザは: Internationalized domain names (IDNs), special characters, and bidirectional text should be handled with care to prevent spoofing:
-
URL のホスト ホスト を次の結果を利用して具現化するべきである :ドメインを Unicode 化する( ホスト, false ) Browsers should render a URL’s host by running domain to Unicode with the URL’s host and false.
注記: 様々な文字が homograph 【同型意義語/同型グリフ】偽装攻撃に利用され得ることに注意。 利用中にある混同され易い文字を検出して警告することを考慮すること。 [IDNFAQ] [UTS39] Various characters can be used in homograph spoofing attacks. Consider detecting confusable characters and warning when they are in use. [IDNFAQ] [UTS39]
- URL が双方向テキストを包含する場合、 特に,ホストとパスが混同され易い。 そのような事例では、 URL のホストのみを具現化することを特に勧める。 可読性を得るために URL の他の部分を具現化する場合、 %-符号化されたバイトたちが成す連列 文字列 を BOM はそのままに UTF-8 復号する( 文字列をバイト列に %-復号する( 文字列 ) ) の結果を成す符号位置列に置換するべきである — その結果が不可視になる場合を除いて。 偽装リスクがあるような一定の並びは復号しないことを選んでもよい (例: U+1F512 (🔒) )。 URLs are particularly prone to confusion between host and path when they contain bidirectional text, so in this case it is particularly advisable to only render a URL’s host. For readability, other parts of the URL, if rendered, should have their sequences of percent-encoded bytes replaced with code points resulting from running UTF-8 decode without BOM on the percent-decoding of those sequences, unless that renders those sequences invisible. Browsers may choose to not decode certain sequences that present spoofing risks (e.g., U+1F512 (🔒)).
-
双方向テキストを左横書き埋め込み( left-to-right embedding )内にあるかのように具現化するべきである。 [BIDI] Browsers should render bidirectional text as if it were in a left-to-right embedding. [BIDI]
注記: あいにく、 具現化される URL は,どこにでも現れるような文字列であり、 具現化される URL に特有な双方向アルゴリズムがあっても, 広範に採用される見込みは薄いであろう。 双方向テキストによる URL の各部への作用は、 ここでのモデルとは異なる具現化にさせ得る。 双方向言語の利用者は、 特に素なテキスト環境の下では,これを期待するようになり得る。 Unfortunately, as rendered URLs are strings and can appear anywhere, a specific bidirectional algorithm for rendered URLs would not see wide adoption. Bidirectional text interacts with the parts of a URL in ways that can cause the rendering to be different from the model. Users of bidirectional languages can come to expect this, particularly in plain text environments.
5. application/x-www-form-urlencoded
application/x-www-form-urlencoded
形式
は、
クエリパラメタたちが成すリストを符号化する仕方を供する。
The application/x-www-form-urlencoded format provides a way to encode a list of tuples, each consisting of a name and a value.
注記:
application/x-www-form-urlencoded
形式は、
何年にもわたる実装の不幸な巡り合わせの結果,多くの面で奇異なものになっており、
相互運用能を得るために必要とされる要件群からなる,妥協の産物である
— 良い設計の実施を表現する仕方は無い。
読者は特に、
文字符号化法とバイト列との間で繰り返される(場合によっては入れ子にされた)変換のひねくれた詳細に,注意を払うように。
あいにく,この形式は HTML フォームに普及しているがため、
広く利用されている。
[HTML]
The application/x-www-form-urlencoded format is in many ways an aberrant monstrosity, the result of many years of implementation accidents and compromises leading to a set of requirements necessary for interoperability, but in no way representing good design practices. In particular, readers are cautioned to pay close attention to the twisted details involving repeated (and in some cases nested) conversions between character encodings and byte sequences. Unfortunately the format is in widespread use due to the prevalence of HTML forms. [HTML]
5.1. application/x-www-form-urlencoded
構文解析法
注記:
旧来のサーバ向け実装には、
UTF-8 以外の符号化法をサポートするとともに[
名 = `_charset
`
]なるクエリパラメタ用に特別なロジックを伴うものもある。
そのようなロジックは、
ここでは述べられない
— 適合するものは UTF-8 に限られる。
A legacy server-oriented implementation might have to support encodings other than UTF-8 as well as have special logic for tuples of which the name is `_charset`. Such logic is not described here as only UTF-8 is conforming.
application/x-www-form-urlencoded
構文解析器
は、
所与の
( バイト列 入力 )
に対し:
The application/x-www-form-urlencoded parser takes a byte sequence input, and then runs these steps:
- バイト列リスト :← 入力 を 0x26 (&) で分割した結果 Let sequences be the result of splitting input on 0x26 (&).
- 出力 :← 新たなリスト(クエリパラメタたち) Let output be an initially empty list of name-value tuples where both name and value hold a string.
-
バイト列リスト を成す 各( バイト列 ) に対し: For each byte sequence bytes in sequences:
- IF[ バイト列 = 空バイト列 ] :CONTINUE If bytes is the empty byte sequence, then continue.
- ( 名, 値 ) :← ( バイト列, 空バイト列 ) ↓
- IF[ バイト列 内に 0x3D (=) が在る ] :( 名, 値 ) ← バイト列 を最初の 0x3D (=) の所で 2 個のバイト列に分割した結果 (その最初の 0x3D (=) は結果に含めない — したがって,いずれも空バイト列になり得る) If bytes contains a 0x3D (=), then let name be the bytes from the start of bytes up to but excluding its first 0x3D (=), and let value be the bytes, if any, after the first 0x3D (=) up to the end of bytes. If 0x3D (=) is the first byte, then name will be the empty byte sequence. If it is the last, then value will be the empty byte sequence.Otherwise, let name have the value of bytes and let value be the empty byte sequence.
- [ 名, 値 ]内のすべての 0x2B (+) を 0x20 (SP) に置換する Replace any 0x2B (+) in name and value with 0x20 (SP).
- 名文字列 :← BOM はそのままに UTF-8 復号する( バイト列をバイト列に %-復号する( 名 ) ) ↓
- 値文字列 :← BOM はそのままに UTF-8 復号する( バイト列をバイト列に %-復号する( 値 ) ) Let nameString and valueString be the result of running UTF-8 decode without BOM on the percent-decoding of name and value, respectively.
- 出力 に ( 名文字列, 値文字列 ) を付加する Append (nameString, valueString) to output.
- RETURN 出力 Return output.
5.2. application/x-www-form-urlencoded
直列化法
application/x-www-form-urlencoded
直列化器
は、
所与の
( リスト パラメタリスト, 符号化法 符号化法 (省略時は UTF-8 ) )
に対し,ASCII 文字列を返す:
The application/x-www-form-urlencoded serializer takes a list of name-value tuples tuples, with an optional encoding encoding (default UTF-8), and then runs these steps. They return an ASCII string.
- 符号化法 ← 符号化法から出力符号化法を取得する( 符号化法 ) Set encoding to the result of getting an output encoding from encoding.
- 出力 :← 空文字列 Let output be the empty string.
-
パラメタリスト を成す 各( パラメタ ) に対し: For each tuple of tuples:
- Assert: パラメタ はクエリパラメタである。 Assert: tuple’s name and tuple’s value are scalar value strings.
-
名 :← 文字列を符号化してから %-符号化する( 符号化法, パラメタ の名,
application/x-www-form-urlencoded
%-符号化集合, true ) Let name be the result of running percent-encode after encoding with encoding, tuple’s name, the application/x-www-form-urlencoded percent-encode set, and true. -
値 :← 文字列を符号化してから %-符号化する( 符号化法, パラメタ の値,
application/x-www-form-urlencoded
%-符号化集合, true ) Let value be the result of running percent-encode after encoding with encoding, tuple’s value, the application/x-www-form-urlencoded percent-encode set, and true. - IF[ 出力 ≠ 空文字列 ] :出力 << U+0026 (&) If output is not the empty string, then append U+0026 (&) to output.
- 出力 << 名 << U+003D (=) << 値 Append name, followed by U+003D (=), followed by value, to output.
- RETURN 出力 Return output.
5.3. フック
application/x-www-form-urlencoded
文字列構文解析器
は、
所与の
( スカラー値文字列 入力 )
に対し
:RETURN application/x-www-form-urlencoded
構文解析器( UTF-8 符号化する( 入力 ) )
The application/x-www-form-urlencoded string parser takes a scalar value string input, UTF-8 encodes it, and then returns the result of application/x-www-form-urlencoded parsing it.
6. API
この節は、 Web IDL による各種用語を利用する。 ブラウザ UA は、 この API をサポートするものとする。 JavaScript 実装は、 この API をサポートするべきである。 他の[ UA /プログラミング言語 ]は、 各自の必要に相応しい API を利用することが奨励される — この API とは異なることもあろうが。 [WEBIDL] This section uses terminology from Web IDL. Browser user agents must support this API. JavaScript implementations should support this API. Other user agents or programming languages are encouraged to use an API suitable to their needs, which might not be this one. [WEBIDL]
6.1. URL
クラス
[Exposed=*, LegacyWindowAlias=webkitURL] interfaceURL
{constructor
(USVString url, optional USVString base); staticURL
?parse
(USVString url, optional USVString base); static booleancanParse
(USVString url, optional USVString base); stringifier attribute USVStringhref
; readonly attribute USVStringorigin
; attribute USVStringprotocol
; attribute USVStringusername
; attribute USVStringpassword
; attribute USVStringhost
; attribute USVStringhostname
; attribute USVStringport
; attribute USVStringpathname
; attribute USVStringsearch
; [SameObject] readonly attributeURLSearchParams
searchParams
; attribute USVStringhash
; USVStringtoJSON
(); };
各 URL
オブジェクトには、
次に挙げるものが結び付けられる:
A URL object has an associated:
- URL :ある URL URL: a URL.
-
クエリオブジェクト
:ある
URLSearchParams
オブジェクト query object: a URLSearchParams object.
API URL 構文解析器 は、 所与の ( スカラー値文字列 URL , [ null /スカラー値文字列] 基底 ) に対し: The API URL parser takes a scalar value string url and an optional null-or-scalar value string base (default null), and then runs these steps:
- 構文解析した基底 :← null Let parsedBase be null.
-
IF[ 基底 ≠ null ]: If base is non-null:
- 構文解析した基底 ← 基本 URL 構文解析器( 基底 ) Set parsedBase to the result of running the basic URL parser on base.
- IF[ 構文解析した基底 = 失敗 ] :RETURN 失敗 If parsedBase is failure, then return failure.
- RETURN 基本 URL 構文解析器( URL , 構文解析した基底 ) Return the result of running the basic URL parser on url with parsedBase.
URL オブジェクトを初期化する
アルゴリズムは、
所与の
( URL
オブジェクト URL , URL レコード URL レコード )
に対し:
To initialize a URL object url with a URL urlRecord:
- クエリ :← URL レコード のクエリ Let query be urlRecord’s query,\
- IF[ クエリ = null ] :クエリ ← 空文字列 if that is non-null; otherwise the empty string.
- URL の URL ← URL レコード Set url’s URL to urlRecord.
-
URL のクエリオブジェクト ← 新たなオブジェクト(
URLSearchParams
) Set url’s query object to a new URLSearchParams object. - クエリオブジェクトを初期化する( URL のクエリオブジェクト, クエリ ) Initialize url’s query object with query.
- URL のクエリオブジェクトの URL オブジェクト ← URL Set url’s query object’s URL object to url.
new URL(url, base)
構築子手続きは:
The new URL(url, base) constructor steps are:
- IF[ base = ε ] :base ← null ↓
- 構文解析した URL :← API URL 構文解析器( url, base ) Let parsedURL be the result of running the API URL parser on url with base, if given.
-
IF[
構文解析した URL = 失敗
]
:THROW
TypeError
If parsedURL is failure, then throw a TypeError. - URL オブジェクトを初期化する( これ°, 構文解析した URL ) Initialize this with parsedURL.
基底 URL を利用せずに,
文字列を構文解析して URL を得るときは、
単独の引数で new URL()
構築子を呼び出す:
To parse a string into a URL without using a base URL, invoke the URL constructor with a single argument:
var input = "https://example.org/💩
", url = new URL(input); url.pathname; // "/%F0%9F%92%A9
"
次のものは、 入力が相対 URL 文字列である場合,例外を投出する: This throws an exception if the input is a relative-URL string:
try {
var url = new URL("/🍣🍺
");
} catch(e) {
// ここに来る
}
基底 URL が必要とされる事例では: For those cases a base URL is necessary:
var input = "/🍣🍺
", url = new URL(input, document.baseURI); url.href; // "https://url.spec.whatwg.org/%F0%9F%8D%A3%F0%9F%8D%BA
"
URL
オブジェクトは、
基底 URL として利用できる
(IDL からは引数として文字列が要求されるので、
URL
オブジェクトは,その href
取得子が返す値に文字列化される):
A URL object can be used as a base URL (as the IDL requires a string as argument, a URL object stringifies to its href getter return value):
var url = new URL("🌈
", new URL("https://pride.example/hello-world
")); url.pathname // "/%F0%9F%8F%B3%EF%B8%8F%E2%80%8D%F0%9F%8C%88
"
parse(url, base)
静的メソッド手続きは:
The static parse(url, base) method steps are:
- 構文解析した URL :← API URL 構文解析器( url, base ) Let parsedURL be the result of running the API URL parser on url with base, if given.
- IF[ 構文解析した URL = 失敗 ] :RETURN null If parsedURL is failure, then return null.
-
URL :← 新たなオブジェクト(
URL
) Let url be a new URL object. - URL オブジェクトを初期化する( URL , 構文解析した URL ) Initialize url with parsedURL.
- RETURN URL Return url.
canParse(url, base)
静的メソッド手続きは:
The static canParse(url, base) method steps are:
- IF[ base = ε ] :base ← null ↓
- 構文解析した URL :← API URL 構文解析器( url, base ) Let parsedURL be the result of running the API URL parser on url with base, if given.
- IF[ 構文解析した URL = 失敗 ] :RETURN false If parsedURL is failure, then return false.
- RETURN true Return true.
toJSON()
メソッド手続き/
href
取得子手続きは:
- RETURN URL を直列化する( これ°の URL )
href
設定子手続きは:
The href setter steps are:
- 構文解析した URL :← 基本 URL 構文解析器( 所与の値 ) Let parsedURL be the result of running the basic URL parser on the given value.
-
IF[
構文解析した URL = 失敗
]
:THROW
TypeError
If parsedURL is failure, then throw a TypeError. - これ°の URL ← 構文解析した URL Set this’s URL to parsedURL.
- これ°のクエリオブジェクトのパラメタリストを空にする Empty this’s query object’s list.
- クエリ :← これ°の URL のクエリ Let query be this’s URL’s query.
-
IF[
クエリ ≠ null
]
:これ°のクエリオブジェクトのパラメタリスト ←
application/x-www-form-urlencoded
文字列構文解析器( クエリ ) If query is non-null, then set this’s query object’s list to the result of parsing query.
origin
取得子手続きは:
The origin getter steps are to return the serialization of this’s URL’s origin. [HTML]
protocol
取得子手続きは:
The protocol getter steps are to return this’s URL’s scheme, followed by U+003A (:).
protocol
設定子手続きは:
- 入力 :← 所与の値 << U+003A (:)
- API 用に URL 構文解析する( 入力, これ°の URL , スキーム開始 state )
username
取得子手続きは:
The username getter steps are to return this’s URL’s username.
username
設定子手続きは:
The username setter steps are:
- URL :← これ°の URL ↓
- IF[ URL はユーザ名/パスワード/ポートを有し得ない ] :RETURN If this’s URL cannot have a username/password/port, then return.
- URL のユーザ名を設定する( URL , 所与の値 ) Set the username given this’s URL and the given value.
password
取得子手続きは:
The password getter steps are to return this’s URL’s password.
password
設定子手続きは:
The password setter steps are:
- URL :← これ°の URL ↓
- IF[ URL はユーザ名/パスワード/ポートを有し得ない ] :RETURN If this’s URL cannot have a username/password/port, then return.
- URL のパスワードを設定する( URL , 所与の値 ) Set the password given this’s URL and the given value.
host
取得子手続きは:
The host getter steps are:
- URL :← これ°の URL Let url be this’s URL.
- IF[ URL のホスト = null ] :RETURN 空文字列 If url’s host is null, then return the empty string.
- ホスト :← ホストを直列化する( ホスト ) ↓
- IF[ URL のポート = null ] :RETURN ホスト If url’s port is null, return url’s host, serialized.
- RETURN ホスト << U+003A (:) << 整数を直列化する( ポート ) Return url’s host, serialized, followed by U+003A (:) and url’s port, serialized.
host
設定子手続きは:
The host setter steps are:
- URL :← これ°の URL ↓
- IF[ URL は不透明なパスを有する ] :RETURN If this’s URL has an opaque path, then return.
- API 用に URL 構文解析する( 所与の値, URL , ホスト state ) Basic URL parse the given value with this’s URL as url and host state as state override.
注記:
host
設定子に与える値が,URL ポート文字列を欠いている場合、
URL のポートは変化しないことになる。
host
取得子が URL ポート文字列を返さないために、
設定子が常に両者を “設定し直す” と見做してしまいそうだが。
If the given value for the host setter lacks a port, this’s URL’s port will not change. This can be unexpected as host getter does return a URL-port string so one might have assumed the setter to always "reset" both.
hostname
取得子手続きは:
The hostname getter steps are:
hostname
設定子手続きは:
The hostname setter steps are:
- URL :← これ°の URL ↓
- IF[ URL は不透明なパスを有する ] :RETURN If this’s URL has an opaque path, then return.
- API 用に URL 構文解析する( 所与の値, URL , ホスト名 state ) Basic URL parse the given value with this’s URL as url and hostname state as state override.
port
取得子手続きは:
The port getter steps are:
port
設定子手続きは:
The port setter steps are:
- URL :← これ°の URL ↓
- IF[ URL はユーザ名/パスワード/ポートを有し得ない ] :RETURN If this’s URL cannot have a username/password/port, then return.
- IF[ 所与の値 = 空文字列 ] :URL のポート ← null If the given value is the empty string, then set this’s URL’s port to null.
- ELSE :API 用に URL 構文解析する( 所与の値, URL , ポート state ) Otherwise, basic URL parse the given value with this’s URL as url and port state as state override.
pathname
取得子手続きは
:RETURN URL パスを直列化する( これ°の URL )
The pathname getter steps are to return the result of URL path serializing this’s URL.
pathname
設定子手続きは:
The pathname setter steps are:
- URL :← これ°の URL ↓
- IF[ URL は不透明なパスを有する ] :RETURN If this’s URL has an opaque path, then return.
- URL のパスを空にする Empty this’s URL’s path.
- API 用に URL 構文解析する( 所与の値, URL , パス開始 state ) Basic URL parse the given value with this’s URL as url and path start state as state override.
search
取得子手続きは:
The search getter steps are:
search
設定子手続きは:
The search setter steps are:
- URL :← これ°の URL Let url be this’s URL.
- 入力 :← 所与の値 ↓
-
IF[ 入力 = 空文字列 ]: If the given value is the empty string, then\
- IF[ 入力 の先頭の符号位置 = U+003F (?) ] :入力 から先頭の符号位置を除去する ↑ Let input be the given value\ with a single leading U+003F (?) removed, if any.
- URL のクエリ ← 空文字列 Set url’s query to the empty string.
- API 用に URL 構文解析する( 入力, URL , クエリ state ) Basic URL parse input with url as url and query state as state override.
-
これ°のクエリオブジェクトのパラメタリスト ←
application/x-www-form-urlencoded
文字列構文解析器( 入力 ) Set this’s query object’s list to the result of parsing input.
searchParams
取得子手続きは:
- RETURN これ°のクエリオブジェクト
hash
取得子手続きは:
The hash getter steps are:
hash
設定子手続きは:
The hash setter steps are:
- URL :← これ°の URL ↓
- 入力 :← 所与の値 ↓
-
IF[ 入力 = 空文字列 ]: If the given value is the empty string, then\
- URL の素片 ← null set this’s URL’s fragment to null\
- RETURN and return.
- IF[ 入力 の先頭の符号位置 = U+0023 (#) ] :入力 から先頭の符号位置を除去する ↑ Let input be the given value\ with a single leading U+0023 (#) removed, if any.
- URL の素片 ← 空文字列 Set this’s URL’s fragment to the empty string.
- API 用に URL 構文解析する( 入力, URL , 素片 state ) Basic URL parse input with this’s URL as url and fragment state as state override.
6.2. URLSearchParams
クラス
[Exposed=*] interfaceURLSearchParams
{constructor
(optional (sequence<sequence<USVString>> or record<USVString, USVString> or USVString) init = ""); readonly attribute unsigned longsize
; undefinedappend
(USVString name, USVString value); undefineddelete
(USVString name, optional USVString value); USVString?get
(USVString name); sequence<USVString>getAll
(USVString name); booleanhas
(USVString name, optional USVString value); undefinedset
(USVString name, USVString value); undefinedsort
();iterable
<USVString, USVString>;stringifier
; };
URLSearchParams
オブジェクトを構築する/文字列化するのは、
簡単である:
Constructing and stringifying a URLSearchParams object is fairly straightforward:
let params = new URLSearchParams({key: "730d67"})
params.toString() // "key=730d67
"
注記:
URLSearchParams
オブジェクトは,application/x-www-form-urlencoded
形式を利用するので、
ある種の符号位置を符号化するときに,
URL
オブジェクトとの相違がある( href
, search
も含め)。
とりわけ、
searchParams
を利用して URL レコードのクエリに対し演算するときには,
意外な結果になり得る。
As a URLSearchParams object uses the application/x-www-form-urlencoded format underneath there are some difference with how it encodes certain code points compared to a URL object (including href and search). This can be especially surprising when using searchParams to operate on a URL’s query.
const url = new URL('https://example.com/?a=b ~'); console.log(url.href); // "https://example.com/?a=b%20~
" url.searchParams.sort(); console.log(url.href); // "https://example.com/?a=b+%7E
"
const url = new URL('https://example.com/?a=~&b=%7E'); console.log(url.search); // "?a=~&b=%7E
" console.log(url.searchParams.get('a')); // "~
" console.log(url.searchParams.get('b')); // "~
"
URLSearchParams
オブジェクトは、[
U+0020 SPACE は U+002B (+) に符号化する/
【他の】符号位置のうち application/x-www-form-urlencoded
%-符号化集合に入るものは %-符号化する
]ことになる。
URLSearchParams objects will percent-encode anything in the application/x-www-form-urlencoded percent-encode set, and will encode U+0020 SPACE as U+002B (+).
search
は,符号化法を無視する(UTF-8 を利用する)下では、
符号位置のうち[
URL レコードは特別であるならば 特別クエリ %-符号化集合/
他の場合は クエリ %-符号化集合
]に入るものを %-符号化することになる。
【これは、クエリ state内の最後近くの段に対応する】
Ignoring encodings (use UTF-8), search will percent-encode anything in the query percent-encode set or the special-query percent-encode set (depending on whether or not the URL is special).
各 URLSearchParams
オブジェクトには、
次に挙げるものが結び付けられる:
A URLSearchParams object has an associated:
- パラメタリスト :クエリパラメタたちが成すリスト — 初期時は空とする。 list: a list of tuples each consisting of a name and a value, initially empty.
-
URL オブジェクト
: null / ある
URL
オブジェクト — 初期時は null とする。 URL object: null or a URL object, initially null.
クエリパラメタ は、 ( スカラー値文字列 名, スカラー値文字列 値 ) が成すタプルである。
【 クエリパラメタは、 他所の記述を集約して意味を明確化するための,この訳による追加 (それに伴い,一部の変数名も改めている( タプル → パラメタ, 等々))。 】
クエリオブジェクトを初期化する
アルゴリズムは、
所与の
( URLSearchParams
オブジェクト クエリ, init )
に対し:
To initialize a URLSearchParams object query with init:
-
init の型に応じて: ↓
-
連列型である:
-
init を成す
各( 内縁連列 )
に対し
:IF[
内縁連列 のサイズ ≠ 2
]
:THROW
TypeError
- init を成す 各( 内縁連列 ) に対し :クエリ のパラメタリストに ( 内縁連列[ 0 ], 内縁連列[ 1 ] ) を付加する
-
init を成す
各( 内縁連列 )
に対し
:IF[
内縁連列 のサイズ ≠ 2
]
:THROW
- レコード型である :init を成す 各( 名 → 値 ) に対し :クエリ のパラメタリストに ( 名, 値 ) を付加する Otherwise, if init is a record,\ then for each name → value of init, append (name, value) to query’s list.
-
文字列である
:クエリ のパラメタリスト ←
application/x-www-form-urlencoded
文字列構文解析器( init ) Otherwise: • Assert: init is a string. • Set query’s list to the result of parsing init.
-
クエリオブジェクトを更新する
アルゴリズムは、
所与の
( URLSearchParams
オブジェクト クエリ )
に対し:
To update a URLSearchParams object query:
- IF[ クエリ の URL オブジェクト = null ] :RETURN If query’s URL object is null, then return.
-
直列化したクエリ :←
application/x-www-form-urlencoded
直列化器( クエリ のパラメタリスト ) Let serializedQuery be the serialization of query’s list. - クエリ の URL オブジェクトの URL のクエリ ← 直列化したクエリ に応じて :空文字列 ならば null / 他の場合は 直列化したクエリ If serializedQuery is the empty string, then set serializedQuery to null.Set query’s URL object’s URL’s query to serializedQuery.
new URLSearchParams(init)
構築子手続きは:
The new URLSearchParams(init) constructor steps are:
- IF[ init の最初の符号位置 = U+003F (?) ] :init から最初の符号位置を除去する If init is a string and starts with U+003F (?), then remove the first code point from init.
- クエリオブジェクトを初期化する( これ°, init ) Initialize this with init.
append(name, value)
メソッド手続きは:
The append(name, value) method steps are:
- これ°のパラメタリストに ( name, value ) を付加する Append (name, value) to this’s list.
- クエリオブジェクトを更新する( これ° ) Update this.
delete(name, value)
メソッド手続きは:
The delete(name, value) method steps are:
- IF[ value ≠ ε ] :これ°のパラメタリストから次を満たすクエリパラメタをすべて除去する :[ 名 = name ]∧[ 値 = value ] If value is given, then remove all tuples whose name is name and value is value from this’s list.
- ELSE :これ°のパラメタリストから次を満たすクエリパラメタをすべて除去する :名 = name Otherwise, remove all tuples whose name is name from this’s list.
- クエリオブジェクトを更新する( これ° ) Update this.
get(name)
メソッド手続きは:
- これ°のパラメタリストを成す 各 ( パラメタ ) に対し :IF[ パラメタ の名 = name ] :RETURN パラメタ の値
- RETURN null
getAll(name)
メソッド手続きは:
has(name, value)
メソッド手続きは:
The has(name, value) method steps are:
-
これ°のパラメタリストを成す 各 ( パラメタ ) に対し:
- IF[ パラメタ の名 ≠ name ] :CONTINUE
- IF[ value = ε ] :RETURN true
- IF[ パラメタ の値 = value ] :RETURN true
- RETURN false Return false.
set(name, value)
メソッド手続きは:
The set(name, value) method steps are:
- パラメタリスト :← これ°のパラメタリスト ↓
- 設定したか :← false ↓
-
パラメタリスト を成す 各( パラメタ ) に対し:
- IF[ パラメタ の名 ≠ name ] :CONTINUE
- IF[ 設定したか = true ] :パラメタリスト から パラメタ を除去する; CONTINUE
- パラメタ の値 ← value
- 設定したか ← true
- IF[ 設定したか = false ] :パラメタリスト に ( name, value ) を付加する Otherwise, append (name, value) to this’s list.
- クエリオブジェクトを更新する( これ° ) Update this.
URLSearchParams
オブジェクトのパラメタリストをソートすると有用になることもある
— 特に,キャッシュヒット率を高めれる。
これは、
sort()
メソッドを呼び出すことで成し遂げれる:
It can be useful to sort the name-value tuples in a URLSearchParams object, in particular to increase cache hits. This can be accomplished through invoking the sort() method:
const url = new URL("https://example.org/?q=🏳️🌈&key=e1f7bc78");
url.searchParams.sort();
url.search; // "?key=e1f7bc78&q=%F0%9F%8F%B3%EF%B8%8F%E2%80%8D%F0%9F%8C%88
"
元の入力を改めたくない場合(例:比較目的)は、
新たな URLSearchParams
オブジェクトを構築する:
To avoid altering the original input, e.g., for comparison purposes, construct a new URLSearchParams object:
const sorted = new URLSearchParams(url.search) sorted.sort()
sort()
メソッド手続きは:
- パラメタリスト :← これ°のパラメタリスト
-
ソート済みリスト :← リストを昇順にソートする( パラメタリスト, 次の手続き )
手続きは、 所与の ( クエリパラメタ A, クエリパラメタ B ) に対し :RETURN IS[ A の名は B の名 未満の符号単位列である ]
- パラメタリスト を空にする
- パラメタリスト を ソート済みリスト で拡張する
- クエリオブジェクトを更新する( これ° )
iterable
における反復される値ペア群は,
これ°のパラメタリストであり、
前者を成す各ペアを成す[
key /値
]は,後者を成す各クエリパラメタを成す[
名/値
]が与えるとする。
The value pairs to iterate over are this’s list’s tuples with the key being the name and the value being the value.
stringifier
における文字列化のふるまいを成す手続きは:
-
RETURN
application/x-www-form-urlencoded
直列化器( これ°のパラメタリスト )
6.3. 他の仕様における URL API
URL を公開する標準は、
URL を(内部的な URL は URL 直列化器にかけるなどして)文字列として公開するべきである。
標準は、
URL
オブジェクトを利用して URL を公開するべきでない。
URL
オブジェクトは、
URL を操作するためにある。
IDL においては、
USVString
型が利用されるべきである。
A standard that exposes URLs, should expose the URL as a string (by serializing an internal URL). A standard should not expose a URL using a URL object. URL objects are meant for URL manipulation. In IDL the USVString type should be used.
注記: より高レベルな観点からは、 それらの値は,変異不能なデータ構造として公開されるものになる。 The higher-level notion here is that values are to be exposed as immutable data structures.
標準が,自身が定義する特能の名前に "URL
" の変種を利用するものと裁定した場合、
その種の特能は "url
" (すなわち,小文字, 末尾は “エル” )と命名するべきであり,
"URL
", "URI
", "IRI
" などの名前は利用されるべきでない。
しかしながら,その名前が複合的なものである場合は、
大文字の "URL
" が好ましい
— "newURL
" や "oldURL
" など。
If a standard decides to use a variant of the name "URL" for a feature it defines, it should name such a feature "url" (i.e., lowercase and with an "l" at the end). Names such as "URL", "URI", and "IRI" should not be used. However, if the name is a compound, "URL" (i.e., uppercase) is preferred, e.g., "newURL" and "oldURL".
注記:
適正な命名例としては、
HTML における[
EventSource
/ HashChangeEvent
]インタフェースが挙げられる。
[HTML]
The EventSource and HashChangeEvent interfaces in HTML are examples of proper naming. [HTML]
謝辞
年月に渡り,たくさんの方々が URL を相互運用可能にするために助力され、 この標準の目標へ近付けてきた。 同様に,この標準は、 多くの方々からの助力により今日の姿に仕立て上げられている: There have been a lot of people that have helped make URLs more interoperable over the years and thereby furthered the goals of this standard. Likewise many people have helped making this standard what it is today.
With that, many thanks to 100の人, Adam Barth, Addison Phillips, Adrián Chaves, Adrien Ricciardi, Albert Wiersch, Alex Christensen, Alexis Hunt, Alexandre Morgaut, Alexis Hunt, Alwin Blok, Andrew Sullivan, Arkadiusz Michalski, Behnam Esfahbod, Bobby Holley, Boris Zbarsky, Brad Hill, Brandon Ross, Cailyn Hansen, Chris Dumez, Chris Rebert, Corey Farwell, Dan Appelquist, Daniel Bratell, Daniel Stenberg, David Burns, David Håsäther, David Sheets, David Singer, David Walp, Domenic Denicola, Emily Schechter, Emily Stark, Eric Lawrence, Erik Arvidsson, Gavin Carothers, Geoff Richards, Glenn Maynard, Gordon P. Hemsley, hemanth, Henri Sivonen, Ian Hickson, Ilya Grigorik, Italo A. Casas, Jakub Gieryluk, James Graham, James Manger, James Ross, Jeff Hodges, Jeffrey Posnick, Jeffrey Yasskin, Joe Duarte, Joshua Bell, Jxck, Karl Wagner, Kemal Zebari, 田村健人 (Kent TAMURA), Kevin Grandon, Kornel Lesiński, Larry Masinter, Leif Halvard Silli, Mark Amery, Mark Davis, Marcos Cáceres, Marijn Kruisselbrink, Martin Dürst, Mathias Bynens, Matt Falkenhagen, Matt Giuca, Michael Peick, Michael™ Smith, Michal Bukovský, Michel Suignard, Mikaël Geljić, Noah Levitt, Peter Occil, Philip Jägenstedt, Philippe Ombredanne, Prayag Verma, Rimas Misevičius, Robert Kieffer, Rodney Rehm, Roy Fielding, Ryan Sleevi, Sam Ruby, Sam Sneddon, Santiago M. Mola, Sebastian Mayr, Shannon Booth, Simon Pieters, Simon Sapin, Steven Vachon, Stuart Cook, Sven Uhlig, Tab Atkins, 吉野剛史 (Takeshi Yoshino), Tantek Çelik, Tiancheng "Timothy" Gu, Tim Berners-Lee, 簡冠庭 (Tim Guan-tin Chien), Titi_Alone, Tomek Wytrębowicz, Trevor Rowbotham, Tristan Seligmann, Valentin Gosu, Vyacheslav Matva, Wei Wang, Wolf Lammen, 山岸和利 (Yamagishi Kazutoshi), Yongsheng Zhang, 成瀬ゆい (Yui Naruse), and zealousidealroll for being awesome!
This standard is written by Anne van Kesteren (Apple, annevk@annevk.nl).
知的財産権
Copyright © WHATWG (Apple, Google, Mozilla, Microsoft). This work is licensed under a Creative Commons Attribution 4.0 International License. To the extent portions of it are incorporated into source code, such portions in the source code are licensed under the BSD 3-Clause License instead.
This is the Living Standard. Those interested in the patent-review version should view the Living Standard Review Draft.