1. 序論
`~HTTP用の有構造~field値^cite `STRUCTURED-FIELDS$r は、 新たな~HTTP~field用の値に利用するため, 構文解析~algoと直列化~algoが結付けられた~data~modelを導入した。 `有構造~field$として定義された~fieldが持ち込む利点には、 次が含まれる: ◎ Structured Field Values for HTTP [STRUCTURED-FIELDS] introduced a data model with associated parsing and serialization algorithms for use by new HTTP field values. Fields that are defined as Structured Fields can bring advantages that include:
- 相互運用能と~securityが改善される ⇒ 精確に定義された[ 構文解析~algo, 直列化~algo ]は、 ~ABNFや注釈文だけを伴って定義された~field用には,概して可用でない。 ◎ Improved interoperability and security: precisely defined parsing and serialisation algorithms are typically not available for fields defined with just ABNF and/or prose.
- 共通な実装の再利用 ⇒ 他の~field用の多くの構文解析器は、[ 単独の~fieldか, 少数の~fieldからなる族 ]に特有である。 ◎ Reuse of common implementations: many parsers for other fields are specific to a single field or a small family of fields.
- 正準的な形 ⇒ 各~型~用に決定論的な直列化~algoが定義されたので、 `有構造~field$には,正準的な表現がある。 ◎ Canonical form: because a deterministic serialisation algorithm is defined for each type, Structure Fields have a canonical representation.
- ~API~supportが増強される ⇒ 定例の~data~modelにより, `~field値$を実装において~nativeな~data構造として公開することが,より容易になる。 ◎ Enhanced API support: a regular data model makes it easier to expose field values as a native data structure in implementations.
- 代替な直列化 ⇒ `STRUCTURED-FIELDS$r は, その~data~modelの~textな直列化を定義するが、 他の,より効率的な下層の~data~modelの直列化もアリになる。 ◎ Alternative serialisations: While [STRUCTURED-FIELDS] defines a textual serialisation of that data model, other, more efficient serialisations of the underlying data model are also possible.
しかしながら,これらの便益が現実化されるためには、 `~field$は,`有構造~field$として定義される必要がある。 既存の`~field$の多くは、 そうでなく,~Internet上の~HTTP流通において見られる大部分の[ `~header$/`~trailer$ ]を成している。 ◎ However, a field needs to be defined as a Structured Field for these benefits to be realised. Many existing fields are not, making up the bulk of header and trailer fields seen in HTTP traffic on the internet.
この仕様は、 これらの便益を現実化できるよう,[ 既存の~HTTP~fieldのうち選定されたものを`有構造~field$として どう取扱えるか ]を定義して、 それらを~retrofit有構造~fieldに仕立て上げる。 ◎ This specification defines how a selection of existing HTTP fields can be handled as Structured Fields, so that these benefits can be realised -- thereby making them Retrofit Structured Fields.
これは、 次の 2 つの技法を利用して行われる: ◎ It does so using two techniques.\
- `互換な~field@#compatible§は、 当の~fieldに定義された構文と`有構造~field$における構文との類似性に因り, `有構造~field$であったかのように取扱える~fieldを挙げる。 ◎ Section 2 lists compatible fields -- those that can be handled as if they were Structured Fields due to the similarity of their defined syntax to that in Structured Fields.\
- `対応付けられる~field@#mapped§は、 当の~fieldの構文を下層の~data~modelの中へ形式変換してから, `有構造~field$により定義される~data~modelの中へ対応付ける必要がある~fieldを挙げる。 ◎ Section 3 lists mapped fields -- those whose syntax needs to be transformed into an underlying data model which is then mapped into that defined by Structured Fields.
1.1. ~retrofit有構造~fieldの利用-法
広く配備された既存の~HTTP~fieldに~data構造を~retrofitすることには、 相互運用能と~securityを確約するよう,注意深い取扱いが要求される。 この節では、 ~retrofit有構造~fieldを利用する応用~用に考慮点を強調する。 ◎ Retrofitting data structures onto existing and widely-deployed HTTP fields requires careful handling to assure interoperability and security. This section highlights considerations for applications that use Retrofit Structured Fields.
~HTTP流通~内で見られる~field値のうち大多数は,成功裡に[ 構文解析される/対応付けられる ]ことが可能になるはずだが、 そうでないものもある。 ~retrofit有構造~fieldを利用している応用は, そのような値をどう取扱うことになるかを定義する必要がある。 ◎ While the majority of field values seen in HTTP traffic should be able to be parsed or mapped successfully, some will not. An application using Retrofit Structured Fields will need to define how unsuccessful values will be handled.
例えば,`有構造~field$用の~data型を利用して~field値を公開する~APIは、 当の~fieldが成功裡に[ 構文解析され/対応付けられ ]なかった事例では,その値を文字列として可用にするかもしれない。 ◎ For example, an API that exposes field values using Structured Fields data types might make the field value available as a string in cases where the field did not successfully parse or map.
`対応付けられる~field@#mapped§に述べられる~field値は、 各自の~fieldの元の構文とは互換でない — なので、[ それらを処理している各~主体が,その形を成す~field値~用に~supportを明示的に指示した場合 ]を除き,利用し得ない。 ~retrofit有構造~fieldを利用している応用は、 互いの~supportを折衝する方法を定義する必要がある。 ◎ The mapped field values described in Section 3 are not compatible with the original syntax of their fields, and so cannot be used unless parties processing them have explicitly indicated their support for that form of the field value. An application using Retrofit Structured Fields will need to define how to negotiate support for them.
例えば,`有構造~field$の利点をとるために各~fieldに代替な直列化を利用する場合、 その前に,[ 互いの端点が直列化を適切に取扱うことを確約するための折衝を仕組み ]を明示的に確立する必要がある。 ◎ For example, an alternative serialization of fields that takes advantage of Structured Fields would need to establish an explicit negotiation mechanism to assure that both peers would handle that serialization appropriately before using it.
`~securityの考慮点@#security§も見よ。 ◎ See also the security considerations in Section 5.
1.2. 表記上の規約
この文書~内の~keyword "MUST" … 【以下、この段落の内容は`~IETF日本語訳 共通~page@~IETFcommon#requirements-notation$に移譲。】 ◎ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "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.
2. 互換な~field
~HTTP~fieldのうち,`表t 1@#compatible-fields$ に挙げるものは、 `STRUCTURED-FIELDS$r に挙げられた~top-level型に対応している[ 構文解析, 直列化 ]~algoに則って,`有構造~field$用の値として取扱える値をとる — `但書き@#compatible-caveats§の~subjectになる下で。 ◎ The HTTP fields listed in Table 1 have values that can be handled as Structured Field Values according to the parsing and serialisation algorithms in [STRUCTURED-FIELDS] corresponding to the listed top-level type, subject to the caveats in Section 2.1.
この表tの 2 列目に挙げる~top-level型は、[ 当の~fieldに定義される構文 ]および[ ~Internetにおける実際の流通 ]との互換性を得るように選ばれた。 しかしながら、 これらの~fieldの~instanceすべてが`有構造~field$用の値として成功裡に構文解析されるとは限らない。 これは、[ 当の`~field値$が明瞭に妥当でないこと/ 妥当であるが,`有構造~field$として構文解析-可能でないこと ]どちらによることもある。 ◎ The top-level types are chosen for compatibility with the defined syntax of the field as well as with actual internet traffic. However, not all instances of these fields will successfully parse as a Structured Field Value. This might be because the field value is clearly invalid, or it might be because it is valid but not parseable as a Structured Field.
この仕様を利用している応用は、 その要件に依存して,そのような`~field値$を取扱う方法を考慮する必要がある。 そのような値[ を却下する/ を不透明な文字列として扱う/ から場当的な流儀で`有構造~field$用の値を回復しようと試みる ]などが挙げられよう。 ◎ An application using this specification will need to consider how to handle such field values. Depending on its requirements, it might be advisable to reject such values, treat them as opaque strings, or attempt to recover a Structured Field Value from them in an ad hoc fashion.
~field名 | 有構造~型 |
---|---|
`Accept$h | `~sf~list$ |
`Accept-Encoding$h | `~sf~list$ |
`Accept-Language$h | `~sf~list$ |
`Accept-Patch$h | `~sf~list$ |
`Accept-Post$h | `~sf~list$ |
`Accept-Ranges$h | `~sf~list$ |
`Access-Control-Allow-Credentials$h | `~sf~item$ |
`Access-Control-Allow-Headers$h | `~sf~list$ |
`Access-Control-Allow-Methods$h | `~sf~list$ |
`Access-Control-Allow-Origin$h | `~sf~item$ |
`Access-Control-Expose-Headers$h | `~sf~list$ |
`Access-Control-Max-Age$h | `~sf~item$ |
`Access-Control-Request-Headers$h | `~sf~list$ |
`Access-Control-Request-Method$h | `~sf~item$ |
`Age$h | `~sf~item$ |
`Allow$h | `~sf~list$ |
`ALPN$h | `~sf~list$ |
`Alt-Svc$h | `~sf辞書$ |
`Alt-Used$h | `~sf~item$ |
`Cache-Control$h | `~sf辞書$ |
`CDN-Loop$h | `~sf~list$ |
`Clear-Site-Data$h | `~sf~list$ |
`Connection$h | `~sf~list$ |
`Content-Encoding$h | `~sf~list$ |
`Content-Language$h | `~sf~list$ |
`Content-Length$h | `~sf~list$ |
`Content-Type$h | `~sf~item$ |
`Cross-Origin-Resource-Policy$h | `~sf~item$ |
`DNT$h | `~sf~item$ |
`Expect$h | `~sf辞書$ |
`Expect-CT$h | `~sf辞書$ |
`Host$h | `~sf~item$ |
`Keep-Alive$h | `~sf辞書$ |
`Max-Forwards$h | `~sf~item$ |
`Origin$h | `~sf~item$ |
`Pragma$h | `~sf辞書$ |
`Prefer$h | `~sf辞書$ |
`Preference-Applied$h | `~sf辞書$ |
`Retry-After$h | `~sf~item$ |
`Sec-WebSocket-Extensions$h | `~sf~list$ |
`Sec-WebSocket-Protocol$h | `~sf~list$ |
`Sec-WebSocket-Version$h | `~sf~item$ |
`Server-Timing$h | `~sf~list$ |
`Surrogate-Control$h | `~sf辞書$ |
`TE$h | `~sf~list$ |
`Timing-Allow-Origin$h | `~sf~list$ |
`Trailer$h | `~sf~list$ |
`Transfer-Encoding$h | `~sf~list$ |
`Upgrade-Insecure-Requests$h | `~sf~item$ |
`Vary$h | `~sf~list$ |
`X-Content-Type-Options$h | `~sf~item$ |
`X-Frame-Options$h | `~sf~item$ |
`X-XSS-Protection$h | `~sf~list$ |
2.1. 但書き
互換性に関しては、 次に挙げる但書きにも注意: ◎ Note the following caveats regarding compatibility:
- 構文解析の相違点: ◎ Parsing differences:
-
一部の値は、 元々指定された構文に則って妥当であっても, `有構造~field$として構文解析することに失敗し得る。 例えば: ◎ Some values may fail to parse as Structured Fields, even though they are valid according to their originally specified syntax. For example,\
- ~HTTPの~parameter名( `parameter-name$p `HTTP$r )は,文字大小無視であり、 `~sf辞書$に基づく多くの~field (例: `Cache-Control$h, `Expect-CT$h, `Pragma$h, `Prefer$h, `Preference-Applied$h, `Surrogate-Control$h ) でも,~keyは文字大小無視であるが、 `有構造~field$においては,すべて小文字にすることが要求される。 【`~sf~key$を見よ。】 ◎ HTTP parameter names are case-insensitive (per Section 5.6.6 of [HTTP]), but Structured Fields require them to be all-lowercase.\ Likewise, many Dictionary-based fields (e.g., Cache-Control, Expect-CT, Pragma, Prefer, Preference-Applied, Surrogate-Control) have case-insensitive keys.\
- ~HTTPの `parameters$p 規則( `HTTP$r )は,区切子 "`;^c" の前に空白を許容するが、 `有構造~field$においては,そうでない。 【`~sf~parameter群$を見よ。】 ◎ Similarly, the parameters rule in HTTP (see Section 5.6.6 of [HTTP]) allows whitespace before the ";" delimiter, but Structured Fields does not.\
- ~HTTPの `quoted-string$p ( `HTTP$r )は, ほとんどの文字に対し~backslashによる~escape法を許容するが、 `有構造~field$における文字列において~escapeできる文字は,[ "`\^c", `DQUOTE$P ]に限られる。 【`~sf文字列$を見よ。】 ◎ And, Section 5.6.4 of [HTTP] allows backslash-escaping most characters in quoted strings, whereas Structured Field Strings only escape "\" and DQUOTE.\
典型的な流通にて見られる~fieldは、 これらの挙動【の相違】を呈さないものが大勢を占めている。 ◎ The vast majority of fields seen in typical traffic do not exhibit these behaviors.
- ~errorの取扱い ◎ Error handling:
- 現在の~HTTP~header用に指定された(または,単に広く実装された)構文解析~algoは、 ~errorの取扱いなど,詳細において`有構造~field$用のものと相違し得る。 例えば、 ~HTTPが[ `Cache-Control$h ~headerにて繰返された`~cache指令$ ]に対し指定する優先順位は,[ この~headerに対応付けられる,`~sf辞書$を値にとる有構造~field ]によりアテガわれるものとは異なる。 ◎ Parsing algorithms specified (or just widely implemented) for current HTTP headers may differ from those in Structured Fields in details such as error handling. For example, HTTP specifies that repeated directives in the Cache-Control header field have a different precedence than that assigned by a Dictionary structured field (which Cache-Control is mapped to).
- `~sf~token$の制限 ◎ Token limitations:
- `有構造~field$における~token(`~sf~token$)は,[ `ALPHA$P / "`*^c" ]から始まることが要求される一方で、 ~HTTPにおける~token( `token$p )は,より広い範囲の文字を許容する。 したがって、 対応付けられた値においては,前者以外の文字から始まる~tokenは利用できない。 例えば,[ `~MIME型$, `~field名$, `~method$, `範囲~単位$, 文字, `転送~符号法$ ]のうち[ `DIGIT$P / "`*^c" 以外の特殊~文字 ]から始まるものは、 ~HTTP~protocol要素としては妥当になり得るが, `~sf~token$としては表現-可能でない。 ◎ In Structured Fields, tokens are required to begin with an alphabetic character or "*", whereas HTTP tokens allow a wider range of characters. This prevents use of mapped values that begin with one of these characters. For example, media types, field names, methods, range-units, character and transfer codings that begin with a number or special character other than "*" might be valid HTTP protocol elements, but will not be able to be represented as Structured Field Tokens.
- `~sf整数$の制限 ◎ Integer limitations:
- `有構造~field$における整数(`~sf整数$)は、 15 桁までである — より大きい値は表現-可能でない。 ◎ Structured Fields Integers can have at most 15 digits; larger values will not be able to be represented in them.
- ~IPv6~literal ◎ IPv6 Literals:
- ~IPv6~literal~addressを値に包含する~field ( `CDN-Loop$h, `Host$h, `Origin$h など ) は、 `~sf~token$として表現-可能でない — それらを区切るために利用される角括弧は、 `~sf~token$においては許容されないので。 ◎ Fields whose values contain IPv6 literal addresses (such as CDN-Loop, Host, and Origin) are not able to be represented as Structured Fields Tokens, because the brackets used to delimit them are not allowed in Tokens.
- 空な`~field値$ ◎ Empty Field Values:
- [ 空な/空白のみからなる ]`~field値$は、 `有構造~field$においては~errorと見なされる。 互換な~fieldにおいては、 これら空な~fieldは,当の~fieldを黙って無視するべきであることを指示する。 ◎ Empty and whitespace-only field values are considered errors in Structured Fields. For compatible fields, an empty field indicates that the field should be silently ignored.
- `Alt-Svc$h ◎ Alt-Svc:
- 一部の~ALPN~token(例: `h3-Q43^c )は、 `~sf~key$の構文に適合しないので,`~sf~token$として表現し得ない。 ~HTTP3の最終-~version【 ~RFC 9114 】は `h3^c ~tokenを利用するので、 これは,長期的な課題にはならないはずだが、 将来の~tokenは,この前提に再び違反し得る。 ◎ Some ALPN tokens (e.g., h3-Q43) do not conform to key's syntax, and therefore cannot be represented as a Token. Since the final version of HTTP/3 uses the h3 token, this shouldn't be a long-term issue, although future tokens may again violate this assumption.
- `Content-Length$h ◎ Content-Length:
- `Content-Length$h は、 `~sf~list$として定義されることに注意 — 実装が複数個の値を誤って送信することは珍しくないので。 その取扱い要件は、 `HTTP$r `Content-Length§h を見よ。 ◎ Note that Content-Length is defined as a List because it is not uncommon for implementations to mistakenly send multiple values. See Section 8.6 of [HTTP] for handling requirements.
- `Retry-After$h ◎ Retry-After:
- 表現できる値は、 `delta-seconds$p に限られる — `HTTP-date$p【!http-date】 を包含している値は、 `有構造~field$用の値として伝達するためには, `delta-seconds$p に変換する必要がある。 ◎ Only the delta-seconds form of Retry-After can be represented; a Retry-After value containing a http-date will need to be converted into delta-seconds to be conveyed as a Structured Field Value.
3. 対応付けられる~field
一部の`~field$用の値の構文は、 `有構造~field$用の値として成功裡に構文解析できない。 代わりに,`有構造~field$用の値に対応付けることが必要yである。 ◎ Some HTTP field values have syntax that cannot be successfully parsed as Structured Field values. Instead, it is necessary to map them into a Structured Field value.
例えば、 `Date$h `~header$は,日時を運ぶ: ◎ For example, the Date HTTP header field carries a date:
Date: Sun, 06 Nov 1994 08:49:37 GMT
その値は、 次のように対応付けられよう: ◎ Its value would be mapped to:
@784111777
`互換な~field@#compatible§ に挙げたものと違って, これらの表現は、 当の~fieldの元の構文とは互換でない — それらは、 明示的にかつ一義的に~supportされない限り,利用してはナラナイ。 このことは、 例えば[ ~HTTPにおいて,それらを`下流$にある次の`受信者$へ送信する ]ためには,先立つ折衝が要求されることを意味する。 この仕様は、 それを行う方法は定義しない。 ◎ Unlike those listed in Section 2, these representations are not compatible with the original fields' syntax, and MUST NOT be used unless they are explicitly and unambiguously supported. For example, this means that sending them to a next-hop recipient in HTTP requires prior negotiation. This specification does not define how to do so.
3.1. ~URL
`表t 2@#url-fields$ に挙げる`~field名$は、 その値を`~sf文字列$として扱うことにより, `有構造~field$用の値に対応付けれる。 ◎ The field names in Table 2 have values that can be mapped into Structured Field values by treating the original field's value as a String.
~field名 |
---|
`Content-Location$h |
`Location$h |
`Referer$h |
例えば、 次の `Location$h ~field: ◎ For example, this Location field
Location: https://example.com/foo
の値を対応付けた結果は: ◎ would have a mapped value of:
"https://example.com/foo"
3.2. 日時
`表t 3@#date-fields$ に挙げる`~field名$ 【言い換えれば、 `HTTP-date$p を値にとる`単数~field$】 は、 その値を[ `HTTP$r `日時の形式@~HTTPinfra#http.date§に則って構文解析した結果 ]を`~sf日時$として表現することにより,`有構造~field$用の値に対応付けれる。 ◎ The field names in Table 3 have values that can be mapped into Structured Field values by parsing their payload according to Section 5.6.7 of [HTTP] and representing the result as a Date.
~field名 |
---|
`Date$h |
`Expires$h |
`If-Modified-Since$h |
`If-Unmodified-Since$h |
`Last-Modified$h |
例えば `Expires$h ~fieldの値は、 次に対応付けることもできる: ◎ For example, an Expires field's value could be mapped as:
@1659578233
4. ~IANA考慮点
【この文書は、以下に挙げる行為を~IANAに依頼する。】
`~HTTP~field名~registry@~IANA-a/http-fields/$cite に対し: ◎ ↓
-
次の注記を追加する: ◎ Please add the following note to the "Hypertext Transfer Protocol (HTTP) Field Name Registry":
- “有構造~型” 列における接頭辞 "`*^c" は、 それが~retrofit型である (すなわち、~nativeに有構造ではない)ことを指示する — ~RFC nnnn 【~RFCとして公表されたときの,この仕様】を見よ。 ◎ A prefix of "*" in the Structured Type column indicates that it is a retrofit type (i.e., not natively Structured); see RFC nnnn.
- 新たな列 “有構造~型( `Structured Type^en )” を追加する — `表t 1@#compatible-fields$( § 2 )に挙げた各~field名に対し, それにアテガわれた有構造~型【!値】を — それが~retrofit型であることを指示する "`*^c" を接頭した上で — 対応する~registry~entryに伴わせる。 ◎ Then, add a new column, "Structured Type", with the values from Section 2 assigned to the nominated registrations, prefixing each with "*" to indicate that it is a retrofit type.
`表t 4@#cookie-params$ の情報を利用して, `COOKIES$r により確立された `~cookie属性~registry@~HTTPcookie#cookie-attribute-registry$cite に新たな列 “有構造~型” を追加する。 ◎ Finally, add a new column to the "Cookie Attribute Registry" established by [COOKIES] with the title "Structured Type", using information from Table 4.
5. ~securityの考慮点
`2@#compatible§は、 既存の~HTTP~fieldのうち[ `STRUCTURED-FIELDS$r にて定義される~algoで構文解析でき, 直列化できるもの ]を識別する。 既存の構文解析器の挙動からの変動は、 悪用-可能かもしれない — 特に、 `連鎖$内のある実装(例:`中継者$)を~targetにすることを攻撃者に許容する場合に。 しかしながら、 すでに配備された構文解析器にも かなりの変動がある — より長期的には、 単独の構文解析~algoへ向けた収束は, 結果的に~securityの便益が得られる見込みが高い。 ◎ Section 2 identifies existing HTTP fields that can be parsed and serialised with the algorithms defined in [STRUCTURED-FIELDS]. Variances from existing parser behavior might be exploitable, particularly if they allow an attacker to target one implementation in a chain (e.g., an intermediary). However, given the considerable variance in parsers already deployed, convergence towards a single parsing algorithm is likely to have a net security benefit in the longer term.
`対応付けられる~field@#mapped§は、 既存の~fieldの代替な表現を定義する。 `下流$にある消費器は,当の`~message$を[ 自身が代替な表現を認識するかどうかに応じて異なるものに解釈する ]かもしれないので、 実装は,そのような`~field値$を`生成-$することは — それらの~supportを相手の端点と折衝していない限り — 禁制される。 この仕様は,そのような折衝の仕組みを定義しないが、 そのような定義は,そうすることによる含意を注意深く考慮する必要がある。 ◎ Section 3 defines alternative representations of existing fields. Because downstream consumers might interpret the message differently based upon whether they recognise the alternative representation, implementations are prohibited from generating such values unless they have negotiated support for them with their peer. This specification does not define such a mechanism, but any such definition needs to consider the implications of doing so carefully.