1. 序論
~HTTP応答が[ その利用に先立って~fetchする必要がある外部~資源 ]への~linkを包含することは、 共通的にある — 例えば,~web~browserによる~HTMLの具現化に必要になるもの【例:~stylesheet】など。 そのような~linkがアリな限り早く`~client$に可用になるのは、 知覚される待時間を最小限にするのを補助する。 ◎ It is common for HTTP responses to contain links to external resources that need to be fetched prior to their use, for example, rendering HTML by a web browser. Having such links available to the client as early as possible helps to minimize perceived latency.
"`preload$c" `Preload$r† ~link関係は、 ~HTTP応答の `Link$h ~header内にそのような~linkを伝達するために利用できる 【†現在は~HTML標準が規範的に定義する】。 しかしながら,`生成元~server$にとっては、 要請を受信した直後に`最終-応答$を成す~header~blockを生成するのは,常にアリとは限らない。 例えば,生成元~serverは、 遠くで稼働している`上流$にある~HTTP~serverへ要請を委任するかもしれないし,`状態s~code$は~database~queryの結果に依存するかもしれない。 ◎ The "preload" [Preload] link relation can be used to convey such links in the Link header field of an HTTP response. However, it is not always possible for an origin server to generate the header block of a final response immediately after receiving a request. For example, the origin server might delegate a request to an upstream HTTP server running at a distant location, or the status code might depend on the result of a database query.
ここでの~dilemmaは、 `生成元~server$にとって[ 要請を受信したなら、 一部の~headerは,すぐ送信する方が好ましい ]ときでも,`最終-応答$を成す[ `状態s~code$, および全部的な~headerたち ]を決定するまで,それができないことにある。 ◎ The dilemma here is that even though it is preferable for an origin server to send some header fields as soon as it receives a request, it cannot do so until the status code and the full header fields of the final HTTP response are determined.
~HTTP2 `RFC7540$r ~server~pushは、 資源の送達を加速できるが,`~server$が権限を有する資源~用に限られる。 ~server~pushにおける もう一つの制限は、 `~client$が応答を~cacheしたかどうかに関わらず,応答が伝送されることにある。 ~server~pushに比較して,[ 1 回だけ余分に往復を費やす~costをかけて,適時に `Link^h ~headerを送達する ]方が、 最悪な事例でも,柔軟かつ消費する帯域幅は少なくなるかもしれない。 ◎ HTTP/2 [RFC7540] server push can accelerate the delivery of resources, but only resources for which the server is authoritative. The other limitation of server push is that the response will be transmitted regardless of whether the client has the response cached. At the cost of spending one extra round trip compared to server push in the worst case, delivering Link header fields in a timely fashion is more flexible and might consume less bandwidth.
このメモは、[ `最終-応答$に内包されると見込まれる~headerを包含する,`非最終-応答$【! 7231/6.2$rfc 】 ]を送信するための`状態s~code$を定義する。 `~server$は、 一部の~headerを包含している非最終-応答を — `~client$が最終-応答の処理~用の準備を開始するのを補助するためとして — 送信してから,時間を消費する演算を 最終-応答を生成するために走らすことができる。 この非最終-応答は、[ `生成元~server$が,~cacheしている`媒介者$にて~HTTP2~server~pushを誘発する ]ためにも利用できる。 ◎ This memo defines a status code for sending an informational response ([RFC7231], Section 6.2) that contains header fields that are likely to be included in the final response. A server can send the informational response containing some of the header fields to help the client start making preparations for processing the final response, and then run time-consuming operations to generate the final response. The informational response can also be used by an origin server to trigger HTTP/2 server push at a caching intermediary.
1.1. 表記規約
この文書~内の~keyword "MUST" … 【以下、この段落の内容は`~IETF日本語訳 共通~page@~IETFcommon#requirements-notation$に移譲。】 ◎ "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.
【この訳に特有な表記規約】
この訳では、 この仕様が公表された当時の~HTTP仕様( `RFC7231$r 他)を参照している箇所を, 現在の中核~HTTP仕様~内の`等価な記述を指すよう改めている@~HTTPcommon#_terms-convention$。
2. ~HTTP状態s~code `103^st
`情報的$な`状態s~code$ `103^st は、 次を`~client$に指示する ⇒ `~server$が送信する`最終-応答$は、 当の`非最終-応答$に内包された~headerたちを伴うと見込まれる。 ◎ The 103 (Early Hints) informational status code indicates to the client that the server is likely to send a final response with the header fields included in the informational response.
`~server$は,概して、 `103^st 応答~内に送信した~headerを`最終-応答$にも内包することになる。 しかしながら,これが望ましくない事例もあるかもしれない — ~serverが`最終-応答$を送信する前に、 `103^st0 応答~内の~headerは正しくないものと知れたときなど。 ◎ Typically, a server will include the header fields sent in a 103 (Early Hints) response in the final response as well. However, there might be cases when this is not desirable, such as when the server learns that the header fields in the 103 (Early Hints) response are not correct before the final response is sent.
`~client$は、 `最終-応答$を待機している間に, `103^st 応答に内包された各~headerを投機的に評価できる。 例えば,~clientは、 関係~型 "`preload$c" を包含している `Link$h `~field値$を認識して,~target資源の~fetchingを開始するかもしれない。 しかしながら,この~headerは、 ~client向けの~hintを供するのみであり,最終-応答の~headerを置換するものではない。 ◎ A client can speculatively evaluate the header fields included in a 103 (Early Hints) response while waiting for the final response. For example, a client might recognize a Link header field value containing the relation type "preload" and start fetching the target resource. However, these header fields only provide hints to the client; they do not replace the header fields on the final response.
処理能の最適化は別として、 `103^st 応答の~headerに対する そのような評価は,`最終-応答$をどう処理するかに影響してはナラナイ。 `~client$は、 `103^st 応答~headerを当の`非最終-応答$自身(例: 当の `103^st0 応答についての~metadata)に適用されるかのように解釈してはナラナイ。 ◎ Aside from performance optimizations, such evaluation of the 103 (Early Hints) response's header fields MUST NOT affect how the final response is processed. A client MUST NOT interpret the 103 (Early Hints) response header fields as if they applied to the informational response itself (e.g., as metadata about the 103 (Early Hints) response).
`103^st 応答を利用する`~server$は、[ `最終-応答$~内に見出されると予期する~header ]すべてを指示しなくともヨイ。 `~client$は、 ある~headerが `103^st 応答~内に存在しないことを,その~headerは最終-応答の一部を成さないであろうと投機的に解釈するベキでない。 ◎ A server MAY use a 103 (Early Hints) response to indicate only some of the header fields that are expected to be found in the final response. A client SHOULD NOT interpret the nonexistence of a header field in a 103 (Early Hints) response as a speculation that the header field is unlikely to be part of the final response.
`103^st 応答を孕む典型的な~message交換を次の例に~illustrateする。 ◎ The following example illustrates a typical message exchange that involves a 103 (Early Hints) response.
~client要請: ◎ Client request:
GET / HTTP/1.1 Host: example.com
~server応答: ◎ Server response:
HTTP/1.1 103 Early Hints
Link: </style.css>; rel=preload; as=style
Link: </script.js>; rel=preload; as=script
HTTP/1.1 200 OK
Date: Fri, 26 May 2017 10:02:11 GMT
Content-Length: 1234
Content-Type: text/html; charset=utf-8
Link: </style.css>; rel=preload; as=style
Link: </script.js>; rel=preload; as=script
<!doctype html>
[...
応答~本体の残りは省略する
◎
rest of the response body is omitted from the example
...]
他の`非最終-応答$と同じく、 `~server$は,`最終-応答$を送信するに先立って複数個の `103^st 応答を発するかもしれない。 これは,例えば、 ~cacheしている`媒介者$が[ `非新鮮$な~cache済み応答の~headerに基づく `103^st0 応答を生成してから, `再検証~要請$に呼応して`生成元~server$から送信されてきた[ `103^st0 応答, および最終-応答 ]を回送するとき ]に起こり得る。 ◎ As is the case with any informational response, a server might emit more than one 103 (Early Hints) response prior to sending a final response. This can happen, for example, when a caching intermediary generates a 103 (Early Hints) response based on the header fields of a stale-cached response, and then forwards a 103 (Early Hints) response and a final response that were sent from the origin server in response to a revalidation request.
`~server$は、 要請を処理している間に新たな情報が可用になるに伴い, 追加的な~headerを伴う複数個の `103^st 応答を発してもヨイ。 すでに発した~headerは繰返す必要はない — それらを除外する必要もないが。 `~client$は、 `最終-応答$に予期される~headerの~listを見越すときに, 複数個の `103^st 応答~内に受信した~headerたちの任意の組合nを考慮できる。 ◎ A server MAY emit multiple 103 (Early Hints) responses with additional header fields as new information becomes available while the request is being processed. It does not need to repeat the fields that were already emitted, though it doesn't have to exclude them either. The client can consider any combination of header fields received in multiple 103 (Early Hints) responses when anticipating the list of header fields expected in the final response.
~serverが発するかもしれない一連の応答を,次の例に~illustrateする。 この例では,~serverは、 2 個の `103^st0 応答を利用して,最終-応答~内に 3 個の `Link$h ~headerを送信すると見込まれることを~clientに通知する。 予期される 3 個の~headerのうち 2 個は,最終-応答~内にそのまま見出され、 残る 1 個は,異なる値を包含する別の `Link^h ~headerにより置換される。 ◎ The following example illustrates a series of responses that a server might emit. In the example, the server uses two 103 (Early Hints) responses to notify the client that it is likely to send three Link header fields in the final response. Two of the three expected header fields are found in the final response. The other header field is replaced by another Link header field that contains a different value.
HTTP/1.1 103 Early Hints
Link: </main.css>; rel=preload; as=style
HTTP/1.1 103 Early Hints
Link: </style.css>; rel=preload; as=style
Link: </script.js>; rel=preload; as=script
HTTP/1.1 200 OK
Date: Fri, 26 May 2017 10:02:11 GMT
Content-Length: 1234
Content-Type: text/html; charset=utf-8
Link: </main.css>; rel=preload; as=style
Link: </newstyle.css>; rel=preload; as=style
Link: </script.js>; rel=preload; as=script
<!doctype html>
[...
応答~本体の残りは省略する
◎
rest of the response body is omitted from the example
...]
3. ~securityの考慮点
一部の`~client$は、 `103$st 応答の取扱いに課題があるかもしれない — `非最終-応答$は、 `Expect$h ~headerを内包していない要請に対する返信においては,稀にしか利用されないので。 ◎ Some clients might have issues handling a 103 (Early Hints) response, because informational responses are rarely used in reply to requests not including an Expect header field ([RFC7231], Section 5.1.1).
特に,`非最終-応答$を`最終-応答$として誤って取扱う~HTTP11~clientは、 同じ接続~越しに~~後続して送信される要請に対する すべての応答を, ~~実際の【!the】最終-応答の一部を成すと見なす見込みが高い。 そのような挙動は、 `~client$が[ 単独の持続的な接続~上にある複数の生成元 ]へ要請たちを多重化する事例では,非同一-生成元に情報を開示する脆弱性を成すかもしれない。 ◎ In particular, an HTTP/1.1 client that mishandles an informational response as a final response is likely to consider all responses to the succeeding requests sent over the same connection to be part of the final response. Such behavior might constitute a cross-origin information disclosure vulnerability in case the client multiplexes requests to different origins onto a single persistent connection.
したがって,`~server$は、 `~client$が`非最終-応答$を正しく取扱うことを知っていない限り, ~HTTP11越しには `103$st 応答の送信を控えるかもしれない。 ◎ Therefore, a server might refrain from sending 103 (Early Hints) responses over HTTP/1.1 unless the client is known to handle informational responses correctly.
~HTTP2~clientは、 不正な~frame法からさほど難を被らないと見込まれる — 応答~headerの取扱いは、 応答~本体の終端をどう決定するかには影響しないので。 ◎ HTTP/2 clients are less likely to suffer from incorrect framing since handling of the response header fields does not affect how the end of the response body is determined.
4. ~IANA考慮点
次の~entryが `~HTTP状態s~code~registry$cite に登録された:
- ~code: `103^st0
- 記述: `Early Hints^en
- 仕様: RFC 8297 (この文書)
A. 謝辞
`非最終-応答$を利用して `Link$h ~headerを送信する案を思いつかれた, `Tatsuhiro Tsujikawa^en 氏に感謝する。 ◎ Thanks to Tatsuhiro Tsujikawa for coming up with the idea of sending the Link header fields using an informational response.
`Mark Nottingham^en, `Willy Tarreau^en 両氏は、 状態s~codeの意味論を明確化することにおいて,かなりの助力を供していただいた。 ◎ Mark Nottingham and Willy Tarreau provided substantial help in clarifying the semantics of the status code.
`DeNA Co., Ltd.^en には、 著作者がそこで雇われている間, この文書の早期の段階における著作者による作業を~supportしていただいた。 ◎ Early stages of the author's work on this document was supported by DeNA Co., Ltd. during his employment there.