HTTP Working Group | M. Nottingham |
Internet-Draft | August 22, 2024 |
Intended status: Standards Track | |
Expires: February 23, 2025 |
This specification nominates a selection of existing HTTP fields whose values are compatible with Structured Fields syntax, so that they can be handled as such (subject to certain caveats).¶
To accommodate some additional fields whose syntax is not compatible, it also defines mappings of their semantics into Structured Fields. It does not specify how to convey them in HTTP messages.¶
This note is to be removed before publishing as an RFC.¶
Status information for this document may be found at <https://datatracker.ietf.org/doc/draft-ietf-httpbis-retrofit/>.¶
Discussion of this document takes place on the HTTP Working Group mailing list (<mailto:ietf-http-wg@w3.org>), which is archived at <https://lists.w3.org/Archives/Public/ietf-http-wg/>. Working Group information can be found at <https://httpwg.org/>.¶
Source for this draft and an issue tracker can be found at <https://github.com/httpwg/http-extensions/labels/retrofit>.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as “work in progress”.¶
This Internet-Draft will expire on February 23, 2025.¶
Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
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:¶
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.¶
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.¶
It does so using two techniques. 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. 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.¶
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.¶
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.¶
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.¶
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.¶
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.¶
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.¶
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.¶
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 Name | Structured Type |
---|---|
Accept | List |
Accept-Encoding | List |
Accept-Language | List |
Accept-Patch | List |
Accept-Post | List |
Accept-Ranges | List |
Access-Control-Allow-Credentials | Item |
Access-Control-Allow-Headers | List |
Access-Control-Allow-Methods | List |
Access-Control-Allow-Origin | Item |
Access-Control-Expose-Headers | List |
Access-Control-Max-Age | Item |
Access-Control-Request-Headers | List |
Access-Control-Request-Method | Item |
Age | Item |
Allow | List |
ALPN | List |
Alt-Svc | Dictionary |
Alt-Used | Item |
Cache-Control | Dictionary |
CDN-Loop | List |
Clear-Site-Data | List |
Connection | List |
Content-Encoding | List |
Content-Language | List |
Content-Length | List |
Content-Type | Item |
Cross-Origin-Resource-Policy | Item |
DNT | Item |
Expect | Dictionary |
Expect-CT | Dictionary |
Host | Item |
Keep-Alive | Dictionary |
Max-Forwards | Item |
Origin | Item |
Pragma | Dictionary |
Prefer | Dictionary |
Preference-Applied | Dictionary |
Retry-After | Item |
Sec-WebSocket-Extensions | List |
Sec-WebSocket-Protocol | List |
Sec-WebSocket-Version | Item |
Server-Timing | List |
Surrogate-Control | Dictionary |
TE | List |
Timing-Allow-Origin | List |
Trailer | List |
Transfer-Encoding | List |
Upgrade-Insecure-Requests | Item |
Vary | List |
X-Content-Type-Options | Item |
X-Frame-Options | Item |
X-XSS-Protection | List |
Note the following caveats regarding compatibility:¶
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.¶
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
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.¶
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 Name |
---|
Content-Location |
Location |
Referer |
For example, this Location field:¶
Location: https://example.com/foo
would have a mapped value of:¶
"https://example.com/foo"
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 Name |
---|
Date |
Expires |
If-Modified-Since |
If-Unmodified-Since |
Last-Modified |
For example, an Expires field's value could be mapped as:¶
@1659578233
Please add the following note to the "Hypertext Transfer Protocol (HTTP) Field Name Registry":¶
A prefix of "*" in the Structured Type column indicates that it is a retrofit type (i.e., not natively Structured); see RFC nnnn.
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.¶
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.¶