妥当なホスト文字列

ホスト (Web)

[4] ホスト (host) は、ドメイン名またはIPアドレスです。

仕様書

意味

[3] ホスト (host) は、ドメインIPv4アドレスIPv6アドレス不透明ホスト空ホストのいずれかです >>2

  1. |
    1. ドメイン
    2. IPv4アドレス
    3. IPv6アドレス
    4. 不透明ホスト
    5. 空ホスト

[5] 普通はホストネットワークアドレスとなりますが、 時たまネットワークアドレスが不要な場面の URL において不透明識別子として利用 (濫用) されます。 >>2

文脈

[162] 項組起源ホスト >>161 は、 起源のうちのホストの部分を表しています。

項組起源参照。

構文解析

[29] ホスト構文解析器 (host parser) は、 文字列入力非特殊 (既定値) について、次のようにします >>30

  1. [33] 入力の先頭が U+005B の場合、
    1. [34] 入力の末尾が U+005D でなければ、
      1. [35] 構文違反です。
      2. [36] 失敗を返し、ここで停止します。
    2. [38] 入力の先頭と末尾の文字を除去します。
    3. [37] 入力IPv6構文解析器を適用した結果を返し、ここで停止します。
  2. [57] 非特殊の場合、
    1. [58] 入力不透明ホスト構文解析器を適用した結果を返し、 ここで停止します。
  3. [39] ドメインを、入力文字列パーセント復号し、 BOMなしUTF-8復号した結果に設定します。
  4. [40] ASCIIドメインを、 ドメインドメインをASCIIにを適用した結果に設定します。
  5. [41] ASCIIドメイン失敗なら、
    1. [42] 失敗を返し、ここで停止します。
  6. [43] ASCIIドメインに次のいずれかが含まれる場合、
    1. [44] 構文違反とします。
    2. [45] 失敗を返し、ここで停止します。
  7. [46] IPv4ホストを、ASCIIドメインIPv4構文解析器を適用した結果に設定します。
  8. [49] IPv4ホストにより、
    失敗
    失敗を返します。
    IPv4アドレス
    IPv4ホストを返します。
    ドメイン
    ASCIIドメインを返します。

[31] 次の場面で呼び出されます。

API

[7] URLUtils インターフェイスhostname IDL属性 >>8 は、ホストを表します。

[9] host IDL属性は、ホストポートを表します。

性質

[20] この属性は、 Unforgeable です >>11

取得器

[16] location.hostname取得器は、次のようにしなければなりません >>11

  1. [24] 文脈オブジェクト関係するDocument起源入口設定群オブジェクト起源同じ起源ドメインでなければ、
    1. [25] SecurityError 例外投げ、ここで停止します。
  2. [26] URLホストnull なら、
    1. [27] 空文字列を返してここで停止します。
  3. [28] URLホストホスト直列化器を適用した結果を返します。

設定器

[12] location.hostname設定器は、次のようにしなければなりません >>11

  1. [21] 入力を、与えられた値を USVString として解釈した結果に設定します。
  2. [13] 文脈オブジェクト関係するDocument起源入口設定群オブジェクト起源同じ起源ドメインでなければ、
    1. [14] SecurityError 例外投げ、ここで停止します。
  3. [15] 複製を、文脈オブジェクトURL に設定します。
  4. [17] 複製cannot-be-a-base-URL flagが設定されていれば、ここで停止します。
  5. [18] 入力基本URL構文解析を適用します。 URL複製状態上書きhostname state とします。
  6. [19] 文脈オブジェクト複製について Location-object-setter navigate を実行します。

関連

[6]ホスト」と「ドメイン」の用語の混乱については、ドメイン名を参照。

[1] authority も参照。

歴史

[10] Be clear about the initial value of the Unicode flag. Fixes https://w… · whatwg/url@468be05 ( 版) <https://github.com/whatwg/url/commit/468be056536ff579e265a65ca7cacf470f2f8040>

[22] Editorial: non-relative flag got renamed · whatwg/html@d360c27 ( 版) <https://github.com/whatwg/html/commit/d360c27d44c52390441b5910d39e898160ec016d>

[23] Merge effective script origin into origin · whatwg/html@8a843f2 ( 版) <https://github.com/whatwg/html/commit/8a843f2169a6864a3024c4329528dccb2051d275>

[52] Editorial: cleanup host similarly to URL (annevk著, ) <https://github.com/whatwg/url/commit/7f9c5fd9236f9a329c48615bce5d25b50f276738>

[53] Add opaque hosts (annevk著, ) <https://github.com/whatwg/url/commit/30362553e9ce9fc706d3492bd61886e399fc94e2>

[54] Editorial: point out that domain to ASCII fails on U+FFFD (annevk著, ) <https://github.com/whatwg/url/commit/cf9854c9e03c12af19e2a249a0d9d6bec6a7419b>

[55] Allow % and IPv6 addresses in non-special URL hosts (rmisev著, ) <https://github.com/whatwg/url/commit/cdbcce62045b1614695b00cc0427f6fb0fc7ed03>

[56] Remove host parser's Unicode flag as it's unnecessary (annevk著, ) <https://github.com/whatwg/url/commit/af93f92a7b937ddacfaa7ce8c158a18a83c9c9d7>

[32] Attempt to explain valid input better (annevk著, ) <https://github.com/whatwg/url/commit/50cb9ab9d8f70cc2bc72e91976bfaea0ad0fd330>

[47] Add empty host concept for file and non-special URLs (rmisev著, ) <https://github.com/whatwg/url/commit/5807b28261e44a47e31683230137da395ddc79d8>

[48] Add empty host concept for file and non-special URLs (rmisev著, ) <https://github.com/whatwg/url/commit/5807b28261e44a47e31683230137da395ddc79d8>

[50] Define percent decoding of strings (annevk著, ) <https://github.com/whatwg/url/commit/e172261b0946036b485322976f93f50707159ce3>

[51] Give host parser a suitable default for the HTML Standard (annevk著, ) <https://github.com/whatwg/url/commit/ac532aeaf418caaa996ed05636b752f2caf118e1>

[59] Give host parser a suitable default for the HTML Standard by annevk · Pull Request #388 · whatwg/url () <https://github.com/whatwg/url/pull/388>