draft-ietf-httpbis-sfbis-00.txt   draft-ietf-httpbis-sfbis-latest.txt 
HTTP Working Group M. Nottingham HTTP Working Group M. Nottingham
Internet-Draft Cloudflare Internet-Draft Cloudflare
Obsoletes: 8941 (if approved) P. Kamp Obsoletes: 8941 (if approved) P. Kamp
Intended status: Standards Track The Varnish Cache Project Intended status: Standards Track The Varnish Cache Project
Expires: May 13, 2023 November 9, 2022 Expires: June 9, 2023 December 6, 2022
Structured Field Values for HTTP Structured Field Values for HTTP
draft-ietf-httpbis-sfbis-00 draft-ietf-httpbis-sfbis-latest
Abstract Abstract
This document describes a set of data types and associated algorithms This document describes a set of data types and associated algorithms
that are intended to make it easier and safer to define and handle that are intended to make it easier and safer to define and handle
HTTP header and trailer fields, known as "Structured Fields", HTTP header and trailer fields, known as "Structured Fields",
"Structured Headers", or "Structured Trailers". It is intended for "Structured Headers", or "Structured Trailers". It is intended for
use by specifications of new HTTP fields that wish to use a common use by specifications of new HTTP fields that wish to use a common
syntax that is more restrictive than traditional HTTP field values. syntax that is more restrictive than traditional HTTP field values.
This document obsoletes RFC 8941; Appendix D lists changes.
About This Document About This Document
This note is to be removed before publishing as an RFC. This note is to be removed before publishing as an RFC.
Status information for this document may be found at Status information for this document may be found at
<https://datatracker.ietf.org/doc/draft-ietf-httpbis-sfbis/>. <https://datatracker.ietf.org/doc/draft-ietf-httpbis-sfbis/>.
Discussion of this document takes place on the HTTP Working Group Discussion of this document takes place on the HTTP Working Group
mailing list (<mailto:ietf-http-wg@w3.org>), which is archived at mailing list (<mailto:ietf-http-wg@w3.org>), which is archived at
<https://lists.w3.org/Archives/Public/ietf-http-wg/>. Working Group <https://lists.w3.org/Archives/Public/ietf-http-wg/>. Working Group
skipping to change at page 2, line 4 skipping to change at page 2, line 6
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at https://datatracker.ietf.org/drafts/current/. Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on May 13, 2023.
This Internet-Draft will expire on June 9, 2023.
Copyright Notice Copyright Notice
Copyright (c) 2022 IETF Trust and the persons identified as the Copyright (c) 2022 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(https://trustee.ietf.org/license-info) in effect on the date of (https://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 2, line 29 skipping to change at page 2, line 32
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1. Intentionally Strict Processing . . . . . . . . . . . . . 4 1.1. Intentionally Strict Processing . . . . . . . . . . . . . 4
1.2. Notational Conventions . . . . . . . . . . . . . . . . . 4 1.2. Notational Conventions . . . . . . . . . . . . . . . . . 4
2. Defining New Structured Fields . . . . . . . . . . . . . . . 5 2. Defining New Structured Fields . . . . . . . . . . . . . . . 5
3. Structured Data Types . . . . . . . . . . . . . . . . . . . . 7 3. Structured Data Types . . . . . . . . . . . . . . . . . . . . 7
3.1. Lists . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.1. Lists . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.1.1. Inner Lists . . . . . . . . . . . . . . . . . . . . . 9 3.1.1. Inner Lists . . . . . . . . . . . . . . . . . . . . . 8
3.1.2. Parameters . . . . . . . . . . . . . . . . . . . . . 9 3.1.2. Parameters . . . . . . . . . . . . . . . . . . . . . 9
3.2. Dictionaries . . . . . . . . . . . . . . . . . . . . . . 10 3.2. Dictionaries . . . . . . . . . . . . . . . . . . . . . . 10
3.3. Items . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.3. Items . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.3.1. Integers . . . . . . . . . . . . . . . . . . . . . . 12 3.3.1. Integers . . . . . . . . . . . . . . . . . . . . . . 11
3.3.2. Decimals . . . . . . . . . . . . . . . . . . . . . . 13 3.3.2. Decimals . . . . . . . . . . . . . . . . . . . . . . 12
3.3.3. Strings . . . . . . . . . . . . . . . . . . . . . . . 13 3.3.3. Strings . . . . . . . . . . . . . . . . . . . . . . . 12
3.3.4. Tokens . . . . . . . . . . . . . . . . . . . . . . . 14 3.3.4. Tokens . . . . . . . . . . . . . . . . . . . . . . . 13
3.3.5. Byte Sequences . . . . . . . . . . . . . . . . . . . 14 3.3.5. Byte Sequences . . . . . . . . . . . . . . . . . . . 13
3.3.6. Booleans . . . . . . . . . . . . . . . . . . . . . . 15 3.3.6. Booleans . . . . . . . . . . . . . . . . . . . . . . 13
4. Working with Structured Fields in HTTP . . . . . . . . . . . 15 3.3.7. Dates . . . . . . . . . . . . . . . . . . . . . . . . 14
4.1. Serializing Structured Fields . . . . . . . . . . . . . . 15 4. Working with Structured Fields in HTTP . . . . . . . . . . . 14
4.1.1. Serializing a List . . . . . . . . . . . . . . . . . 16 4.1. Serializing Structured Fields . . . . . . . . . . . . . . 14
4.1.2. Serializing a Dictionary . . . . . . . . . . . . . . 18 4.1.1. Serializing a List . . . . . . . . . . . . . . . . . 15
4.1.3. Serializing an Item . . . . . . . . . . . . . . . . . 18 4.1.2. Serializing a Dictionary . . . . . . . . . . . . . . 17
4.1.4. Serializing an Integer . . . . . . . . . . . . . . . 19 4.1.3. Serializing an Item . . . . . . . . . . . . . . . . . 17
4.1.5. Serializing a Decimal . . . . . . . . . . . . . . . . 20 4.1.4. Serializing an Integer . . . . . . . . . . . . . . . 18
4.1.6. Serializing a String . . . . . . . . . . . . . . . . 20 4.1.5. Serializing a Decimal . . . . . . . . . . . . . . . . 19
4.1.7. Serializing a Token . . . . . . . . . . . . . . . . . 21 4.1.6. Serializing a String . . . . . . . . . . . . . . . . 19
4.1.8. Serializing a Byte Sequence . . . . . . . . . . . . . 21 4.1.7. Serializing a Token . . . . . . . . . . . . . . . . . 20
4.1.9. Serializing a Boolean . . . . . . . . . . . . . . . . 22 4.1.8. Serializing a Byte Sequence . . . . . . . . . . . . . 20
4.2. Parsing Structured Fields . . . . . . . . . . . . . . . . 22 4.1.9. Serializing a Boolean . . . . . . . . . . . . . . . . 21
4.2.1. Parsing a List . . . . . . . . . . . . . . . . . . . 24 4.1.10. Serialising a Date . . . . . . . . . . . . . . . . . 21
4.2. Parsing Structured Fields . . . . . . . . . . . . . . . . 21
4.2.1. Parsing a List . . . . . . . . . . . . . . . . . . . 23
4.2.2. Parsing a Dictionary . . . . . . . . . . . . . . . . 25 4.2.2. Parsing a Dictionary . . . . . . . . . . . . . . . . 25
4.2.3. Parsing an Item . . . . . . . . . . . . . . . . . . . 26 4.2.3. Parsing an Item . . . . . . . . . . . . . . . . . . . 26
4.2.4. Parsing an Integer or Decimal . . . . . . . . . . . . 29 4.2.4. Parsing an Integer or Decimal . . . . . . . . . . . . 28
4.2.5. Parsing a String . . . . . . . . . . . . . . . . . . 30 4.2.5. Parsing a String . . . . . . . . . . . . . . . . . . 29
4.2.6. Parsing a Token . . . . . . . . . . . . . . . . . . . 31 4.2.6. Parsing a Token . . . . . . . . . . . . . . . . . . . 30
4.2.7. Parsing a Byte Sequence . . . . . . . . . . . . . . . 31 4.2.7. Parsing a Byte Sequence . . . . . . . . . . . . . . . 30
4.2.8. Parsing a Boolean . . . . . . . . . . . . . . . . . . 32 4.2.8. Parsing a Boolean . . . . . . . . . . . . . . . . . . 31
4.2.9. Parsing a Date . . . . . . . . . . . . . . . . . . . 32
5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 32 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 32
6. Security Considerations . . . . . . . . . . . . . . . . . . . 32 6. Security Considerations . . . . . . . . . . . . . . . . . . . 32
7. References . . . . . . . . . . . . . . . . . . . . . . . . . 33 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 32
7.1. Normative References . . . . . . . . . . . . . . . . . . 33 7.1. Normative References . . . . . . . . . . . . . . . . . . 32
7.2. Informative References . . . . . . . . . . . . . . . . . 33 7.2. Informative References . . . . . . . . . . . . . . . . . 33
Appendix A. Frequently Asked Questions . . . . . . . . . . . . . 34 Appendix A. Frequently Asked Questions . . . . . . . . . . . . . 34
A.1. Why Not JSON? . . . . . . . . . . . . . . . . . . . . . . 34 A.1. Why Not JSON? . . . . . . . . . . . . . . . . . . . . . . 34
Appendix B. Implementation Notes . . . . . . . . . . . . . . . . 35 Appendix B. Implementation Notes . . . . . . . . . . . . . . . . 35
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 36 Appendix C. ABNF . . . . . . . . . . . . . . . . . . . . . . . . 35
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 36 Appendix D. Changes from RFC 8941 . . . . . . . . . . . . . . . 36
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 37
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 37
1. Introduction 1. Introduction
Specifying the syntax of new HTTP header (and trailer) fields is an Specifying the syntax of new HTTP header (and trailer) fields is an
onerous task; even with the guidance in Section 8.3.1 of [RFC7231], onerous task; even with the guidance in Section 16.3.2 of [HTTP],
there are many decisions -- and pitfalls -- for a prospective HTTP there are many decisions -- and pitfalls -- for a prospective HTTP
field author. field author.
Once a field is defined, bespoke parsers and serializers often need Once a field is defined, bespoke parsers and serializers often need
to be written, because each field value has a slightly different to be written, because each field value has a slightly different
handling of what looks like common syntax. handling of what looks like common syntax.
This document introduces a set of common data structures for use in This document introduces a set of common data structures for use in
definitions of new HTTP field values to address these problems. In definitions of new HTTP field values to address these problems. In
particular, it defines a generic, abstract model for them, along with particular, it defines a generic, abstract model for them, along with
a concrete serialization for expressing that model in HTTP [RFC7230] a concrete serialization for expressing that model in HTTP [HTTP]
header and trailer fields. header and trailer fields.
An HTTP field that is defined as a "Structured Header" or "Structured An HTTP field that is defined as a "Structured Header" or "Structured
Trailer" (if the field can be either, it is a "Structured Field") Trailer" (if the field can be either, it is a "Structured Field")
uses the types defined in this specification to define its syntax and uses the types defined in this specification to define its syntax and
basic handling rules, thereby simplifying both its definition by basic handling rules, thereby simplifying both its definition by
specification writers and handling by implementations. specification writers and handling by implementations.
Additionally, future versions of HTTP can define alternative Additionally, future versions of HTTP can define alternative
serializations of the abstract model of these structures, allowing serializations of the abstract model of these structures, allowing
skipping to change at page 4, line 48 skipping to change at page 5, line 6
1.2. Notational Conventions 1.2. Notational Conventions
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in BCP "OPTIONAL" in this document are to be interpreted as described in BCP
14 [RFC2119] [RFC8174] when, and only when, they appear in all 14 [RFC2119] [RFC8174] when, and only when, they appear in all
capitals, as shown here. capitals, as shown here.
This document uses algorithms to specify parsing and serialization This document uses algorithms to specify parsing and serialization
behaviors and the Augmented Backus-Naur Form (ABNF) notation of behaviors. When parsing from HTTP fields, implementations MUST have
[RFC5234] to illustrate expected syntax in HTTP header fields. In behavior that is indistinguishable from following the algorithms.
doing so, it uses the VCHAR, SP, DIGIT, ALPHA, and DQUOTE rules from
[RFC5234]. It also includes the tchar and OWS rules from [RFC7230].
When parsing from HTTP fields, implementations MUST have behavior
that is indistinguishable from following the algorithms. If there is
disagreement between the parsing algorithms and ABNF, the specified
algorithms take precedence.
For serialization to HTTP fields, the ABNF illustrates their expected For serialization to HTTP fields, the algorithms define the
wire representations, and the algorithms define the recommended way recommended way to produce them. Implementations MAY vary from the
to produce them. Implementations MAY vary from the specified specified behavior so long as the output is still correctly handled
behavior so long as the output is still correctly handled by the by the parsing algorithm described in Section 4.2.
parsing algorithm described in Section 4.2.
2. Defining New Structured Fields 2. Defining New Structured Fields
To specify an HTTP field as a Structured Field, its authors need to: To specify an HTTP field as a Structured Field, its authors need to:
o Normatively reference this specification. Recipients and o Normatively reference this specification. Recipients and
generators of the field need to know that the requirements of this generators of the field need to know that the requirements of this
document are in effect. document are in effect.
o Identify whether the field is a Structured Header (i.e., it can o Identify whether the field is a Structured Header (i.e., it can
skipping to change at page 6, line 49 skipping to change at page 6, line 46
various structures supported by implementations. It does not specify various structures supported by implementations. It does not specify
maximum sizes in most cases, but authors should be aware that HTTP maximum sizes in most cases, but authors should be aware that HTTP
implementations do impose various limits on the size of individual implementations do impose various limits on the size of individual
fields, the total number of fields, and/or the size of the entire fields, the total number of fields, and/or the size of the entire
header or trailer section. header or trailer section.
Specifications can refer to a field name as a "structured header Specifications can refer to a field name as a "structured header
name", "structured trailer name", or "structured field name" as name", "structured trailer name", or "structured field name" as
appropriate. Likewise, they can refer its field value as a appropriate. Likewise, they can refer its field value as a
"structured header value", "structured trailer value", or "structured "structured header value", "structured trailer value", or "structured
field value" as necessary. Field definitions are encouraged to use field value" as necessary.
the ABNF rules beginning with "sf-" defined in this specification;
other rules in this specification are not intended to be used in
field definitions.
For example, a fictitious Foo-Example header field might be specified For example, a fictitious Foo-Example header field might be specified
as: as:
42. Foo-Example Header 42. Foo-Example Header
The Foo-Example HTTP header field conveys information about how The Foo-Example HTTP header field conveys information about how
much Foo the message has. much Foo the message has.
Foo-Example is an Item Structured Header [RFC8941]. Its value Foo-Example is an Item Structured Header [RFC8941]. Its value
MUST be an Integer (Section 3.3.1 of [RFC8941]). Its ABNF is: MUST be an Integer (Section 3.3.1 of [RFC8941]).
Foo-Example = sf-integer
Its value indicates the amount of Foo in the message, and it MUST Its value indicates the amount of Foo in the message, and it MUST
be between 0 and 10, inclusive; other values MUST cause the entire be between 0 and 10, inclusive; other values MUST cause the entire
header field to be ignored. header field to be ignored.
The following parameter is defined: The following parameter is defined:
* A parameter whose key is "foourl", and whose value is a String * A parameter whose key is "foourl", and whose value is a String
(Section 3.3.3 of [RFC8941]), conveying the Foo URL for the (Section 3.3.3 of [RFC8941]), conveying the Foo URL for the
message. See below for processing requirements. message. See below for processing requirements.
skipping to change at page 7, line 40 skipping to change at page 7, line 32
MUST be ignored. If its value is a relative reference MUST be ignored. If its value is a relative reference
(Section 4.2 of [RFC3986]), it MUST be resolved (Section 5 of (Section 4.2 of [RFC3986]), it MUST be resolved (Section 5 of
[RFC3986]) before being used. [RFC3986]) before being used.
For example: For example:
Foo-Example: 2; foourl="https://foo.example.com/" Foo-Example: 2; foourl="https://foo.example.com/"
3. Structured Data Types 3. Structured Data Types
This section defines the abstract types for Structured Fields. The This section defines the abstract types for Structured Fields, and
ABNF provided represents the on-wire format in HTTP field values. summarises how those types are serialised into textual HTTP fields.
In summary: In summary:
o There are three top-level types that an HTTP field can be defined o There are three top-level types that an HTTP field can be defined
as: Lists, Dictionaries, and Items. as: Lists, Dictionaries, and Items.
o Lists and Dictionaries are containers; their members can be Items o Lists and Dictionaries are containers; their members can be Items
or Inner Lists (which are themselves arrays of Items). or Inner Lists (which are themselves arrays of Items).
o Both Items and Inner Lists can be Parameterized with key/value o Both Items and Inner Lists can be Parameterized with key/value
pairs. pairs.
3.1. Lists 3.1. Lists
Lists are arrays of zero or more members, each of which can be an Lists are arrays of zero or more members, each of which can be an
Item (Section 3.3) or an Inner List (Section 3.1.1), both of which Item (Section 3.3) or an Inner List (Section 3.1.1), both of which
can be Parameterized (Section 3.1.2). can be Parameterized (Section 3.1.2).
The ABNF for Lists in HTTP fields is: An empty List is denoted by not serializing the field at all. This
implies that fields defined as Lists have a default empty value.
sf-list = list-member *( OWS "," OWS list-member )
list-member = sf-item / inner-list
Each member is separated by a comma and optional whitespace. For When serialised as a textual HTTP field, each member is separated by
example, a field whose value is defined as a List of Tokens could a comma and optional whitespace. For example, a field whose value is
look like: defined as a List of Tokens could look like:
Example-List: sugar, tea, rum Example-List: sugar, tea, rum
An empty List is denoted by not serializing the field at all. This
implies that fields defined as Lists have a default empty value.
Note that Lists can have their members split across multiple lines of Note that Lists can have their members split across multiple lines of
the same header or trailer section, as per Section 3.2.2 of the same header or trailer section, as per Section 5.3 of [HTTP]; for
[RFC7230]; for example, the following are equivalent: example, the following are equivalent:
Example-List: sugar, tea, rum Example-List: sugar, tea, rum
and and
Example-List: sugar, tea Example-List: sugar, tea
Example-List: rum Example-List: rum
However, individual members of a List cannot be safely split between However, individual members of a List cannot be safely split between
lines; see Section 4.2 for details. lines; see Section 4.2 for details.
skipping to change at page 9, line 11 skipping to change at page 8, line 44
Parsers MUST support Lists containing at least 1024 members. Field Parsers MUST support Lists containing at least 1024 members. Field
specifications can constrain the types and cardinality of individual specifications can constrain the types and cardinality of individual
List values as they require. List values as they require.
3.1.1. Inner Lists 3.1.1. Inner Lists
An Inner List is an array of zero or more Items (Section 3.3). Both An Inner List is an array of zero or more Items (Section 3.3). Both
the individual Items and the Inner List itself can be Parameterized the individual Items and the Inner List itself can be Parameterized
(Section 3.1.2). (Section 3.1.2).
The ABNF for Inner Lists is: When serialised in a textual HTTP field, Inner Lists are denoted by
surrounding parenthesis, and their values are delimited by one or
inner-list = "(" *SP [ sf-item *( 1*SP sf-item ) *SP ] ")" more spaces. A field whose value is defined as a List of Inner Lists
parameters of Strings could look like:
Inner Lists are denoted by surrounding parenthesis, and their values
are delimited by one or more spaces. A field whose value is defined
as a List of Inner Lists of Strings could look like:
Example-List: ("foo" "bar"), ("baz"), ("bat" "one"), () Example-List: ("foo" "bar"), ("baz"), ("bat" "one"), ()
Note that the last member in this example is an empty Inner List. Note that the last member in this example is an empty Inner List.
A header field whose value is defined as a List of Inner Lists with A header field whose value is defined as a List of Inner Lists with
Parameters at both levels could look like: Parameters at both levels could look like:
Example-List: ("foo"; a=1;b=2);lvl=5, ("bar" "baz");lvl=1 Example-List: ("foo"; a=1;b=2);lvl=5, ("bar" "baz");lvl=1
skipping to change at page 9, line 44 skipping to change at page 9, line 25
Parameters are an ordered map of key-value pairs that are associated Parameters are an ordered map of key-value pairs that are associated
with an Item (Section 3.3) or Inner List (Section 3.1.1). The keys with an Item (Section 3.3) or Inner List (Section 3.1.1). The keys
are unique within the scope of the Parameters they occur within, and are unique within the scope of the Parameters they occur within, and
the values are bare items (i.e., they themselves cannot be the values are bare items (i.e., they themselves cannot be
parameterized; see Section 3.3). parameterized; see Section 3.3).
Implementations MUST provide access to Parameters both by index and Implementations MUST provide access to Parameters both by index and
by key. Specifications MAY use either means of accessing them. by key. Specifications MAY use either means of accessing them.
The ABNF for Parameters is: Note that parameters are ordered, and parameter keys cannot contain
uppercase letters.
parameters = *( ";" *SP parameter ) When serialised in a textual HTTP field, a Parameter is separated
parameter = param-key [ "=" param-value ] from its Item or Inner List and other Parameters by a semicolon. For
param-key = key example:
key = ( lcalpha / "*" )
*( lcalpha / DIGIT / "_" / "-" / "." / "*" )
lcalpha = %x61-7A ; a-z
param-value = bare-item
Note that parameters are ordered as serialized, and parameter keys
cannot contain uppercase letters. A parameter is separated from its
Item or Inner List and other parameters by a semicolon. For example:
Example-List: abc;a=1;b=2; cde_456, (ghi;jk=4 l);q="9";r=w Example-List: abc;a=1;b=2; cde_456, (ghi;jk=4 l);q="9";r=w
Parameters whose value is Boolean (see Section 3.3.6) true MUST omit Parameters whose value is Boolean (see Section 3.3.6) true MUST omit
that value when serialized. For example, the "a" parameter here is that value when serialized. For example, the "a" parameter here is
true, while the "b" parameter is false: true, while the "b" parameter is false:
Example-Integer: 1; a; b=?0 Example-Integer: 1; a; b=?0
Note that this requirement is only on serialization; parsers are Note that this requirement is only on serialization; parsers are
skipping to change at page 10, line 37 skipping to change at page 10, line 17
Dictionaries are ordered maps of key-value pairs, where the keys are Dictionaries are ordered maps of key-value pairs, where the keys are
short textual strings and the values are Items (Section 3.3) or short textual strings and the values are Items (Section 3.3) or
arrays of Items, both of which can be Parameterized (Section 3.1.2). arrays of Items, both of which can be Parameterized (Section 3.1.2).
There can be zero or more members, and their keys are unique in the There can be zero or more members, and their keys are unique in the
scope of the Dictionary they occur within. scope of the Dictionary they occur within.
Implementations MUST provide access to Dictionaries both by index and Implementations MUST provide access to Dictionaries both by index and
by key. Specifications MAY use either means of accessing the by key. Specifications MAY use either means of accessing the
members. members.
The ABNF for Dictionaries is: As with Lists, an empty Dictionary is represented by omitting the
entire field. This implies that fields defined as Dictionaries have
a default empty value.
sf-dictionary = dict-member *( OWS "," OWS dict-member ) Typically, a field specification will define the semantics of
dict-member = member-key ( parameters / ( "=" member-value )) Dictionaries by specifying the allowed type(s) for individual members
member-key = key by their keys, as well as whether their presence is required or
member-value = sf-item / inner-list optional. Recipients MUST ignore members whose keys that are
undefined or unknown, unless the field's specification specifically
disallows them.
Members are ordered as serialized and separated by a comma with When serialised as a textual HTTP field, Members are ordered as
optional whitespace. Member keys cannot contain uppercase serialized and separated by a comma with optional whitespace. Member
characters. Keys and values are separated by "=" (without keys cannot contain uppercase characters. Keys and values are
whitespace). For example: separated by "=" (without whitespace). For example:
Example-Dict: en="Applepie", da=:w4ZibGV0w6ZydGU=: Example-Dict: en="Applepie", da=:w4ZibGV0w6ZydGU=:
Note that in this example, the final "=" is due to the inclusion of a Note that in this example, the final "=" is due to the inclusion of a
Byte Sequence; see Section 3.3.5. Byte Sequence; see Section 3.3.5.
Members whose value is Boolean (see Section 3.3.6) true MUST omit Members whose value is Boolean (see Section 3.3.6) true MUST omit
that value when serialized. For example, here both "b" and "c" are that value when serialized. For example, here both "b" and "c" are
true: true:
skipping to change at page 11, line 21 skipping to change at page 11, line 4
Example-Dict: a=?0, b, c; foo=bar Example-Dict: a=?0, b, c; foo=bar
Note that this requirement is only on serialization; parsers are Note that this requirement is only on serialization; parsers are
still required to correctly handle the true Boolean value when it still required to correctly handle the true Boolean value when it
appears in Dictionary values. appears in Dictionary values.
A Dictionary with a member whose value is an Inner List of Tokens: A Dictionary with a member whose value is an Inner List of Tokens:
Example-Dict: rating=1.5, feelings=(joy sadness) Example-Dict: rating=1.5, feelings=(joy sadness)
A Dictionary with a mix of Items and Inner Lists, some with A Dictionary with a mix of Items and Inner Lists, some with
parameters: parameters:
Example-Dict: a=(1 2), b=3, c=4;aa=bb, d=(5 6);valid Example-Dict: a=(1 2), b=3, c=4;aa=bb, d=(5 6);valid
As with Lists, an empty Dictionary is represented by omitting the
entire field. This implies that fields defined as Dictionaries have
a default empty value.
Typically, a field specification will define the semantics of
Dictionaries by specifying the allowed type(s) for individual members
by their keys, as well as whether their presence is required or
optional. Recipients MUST ignore members whose keys that are
undefined or unknown, unless the field's specification specifically
disallows them.
Note that Dictionaries can have their members split across multiple Note that Dictionaries can have their members split across multiple
lines of the same header or trailer section; for example, the lines of the same header or trailer section; for example, the
following are equivalent: following are equivalent:
Example-Dict: foo=1, bar=2 Example-Dict: foo=1, bar=2
and and
Example-Dict: foo=1 Example-Dict: foo=1
Example-Dict: bar=2 Example-Dict: bar=2
skipping to change at page 12, line 17 skipping to change at page 11, line 35
constrain the order of individual Dictionary members, as well as constrain the order of individual Dictionary members, as well as
their values' types as required. their values' types as required.
3.3. Items 3.3. Items
An Item can be an Integer (Section 3.3.1), a Decimal (Section 3.3.2), An Item can be an Integer (Section 3.3.1), a Decimal (Section 3.3.2),
a String (Section 3.3.3), a Token (Section 3.3.4), a Byte Sequence a String (Section 3.3.3), a Token (Section 3.3.4), a Byte Sequence
(Section 3.3.5), or a Boolean (Section 3.3.6). It can have (Section 3.3.5), or a Boolean (Section 3.3.6). It can have
associated parameters (Section 3.1.2). associated parameters (Section 3.1.2).
The ABNF for Items is:
sf-item = bare-item parameters
bare-item = sf-integer / sf-decimal / sf-string / sf-token
/ sf-binary / sf-boolean
For example, a header field that is defined to be an Item that is an For example, a header field that is defined to be an Item that is an
Integer might look like: Integer might look like:
Example-Integer: 5 Example-Integer: 5
or with parameters: or with parameters:
Example-Integer: 5; foo=bar Example-Integer: 5; foo=bar
3.3.1. Integers 3.3.1. Integers
Integers have a range of -999,999,999,999,999 to 999,999,999,999,999 Integers have a range of -999,999,999,999,999 to 999,999,999,999,999
inclusive (i.e., up to fifteen digits, signed), for IEEE 754 inclusive (i.e., up to fifteen digits, signed), for IEEE 754
compatibility [IEEE754]. compatibility [IEEE754].
The ABNF for Integers is:
sf-integer = ["-"] 1*15DIGIT
For example: For example:
Example-Integer: 42 Example-Integer: 42
Integers larger than 15 digits can be supported in a variety of ways; Integers larger than 15 digits can be supported in a variety of ways;
for example, by using a String (Section 3.3.3), a Byte Sequence for example, by using a String (Section 3.3.3), a Byte Sequence
(Section 3.3.5), or a parameter on an Integer that acts as a scaling (Section 3.3.5), or a parameter on an Integer that acts as a scaling
factor. factor.
While it is possible to serialize Integers with leading zeros (e.g., While it is possible to serialize Integers with leading zeros (e.g.,
skipping to change at page 13, line 18 skipping to change at page 12, line 25
Note that commas in Integers are used in this section's prose only Note that commas in Integers are used in this section's prose only
for readability; they are not valid in the wire format. for readability; they are not valid in the wire format.
3.3.2. Decimals 3.3.2. Decimals
Decimals are numbers with an integer and a fractional component. The Decimals are numbers with an integer and a fractional component. The
integer component has at most 12 digits; the fractional component has integer component has at most 12 digits; the fractional component has
at most three digits. at most three digits.
The ABNF for decimals is:
sf-decimal = ["-"] 1*12DIGIT "." 1*3DIGIT
For example, a header whose value is defined as a Decimal could look For example, a header whose value is defined as a Decimal could look
like: like:
Example-Decimal: 4.5 Example-Decimal: 4.5
While it is possible to serialize Decimals with leading zeros (e.g., While it is possible to serialize Decimals with leading zeros (e.g.,
"0002.5", "-01.334"), trailing zeros (e.g., "5.230", "-0.40"), and "0002.5", "-01.334"), trailing zeros (e.g., "5.230", "-0.40"), and
signed zero (e.g., "-0.0"), these distinctions may not be preserved signed zero (e.g., "-0.0"), these distinctions may not be preserved
by implementations. by implementations.
skipping to change at page 13, line 43 skipping to change at page 12, line 46
with more than three digits of precision in the fractional component. with more than three digits of precision in the fractional component.
If an alternative rounding strategy is desired, this should be If an alternative rounding strategy is desired, this should be
specified by the header definition to occur before serialization. specified by the header definition to occur before serialization.
3.3.3. Strings 3.3.3. Strings
Strings are zero or more printable ASCII [RFC0020] characters (i.e., Strings are zero or more printable ASCII [RFC0020] characters (i.e.,
the range %x20 to %x7E). Note that this excludes tabs, newlines, the range %x20 to %x7E). Note that this excludes tabs, newlines,
carriage returns, etc. carriage returns, etc.
The ABNF for Strings is: Unicode is not directly supported in Strings, because it causes a
number of interoperability issues, and -- with few exceptions --
field values do not require it.
sf-string = DQUOTE *chr DQUOTE When it is necessary for a field value to convey non-ASCII content, a
chr = unescaped / escaped Byte Sequence (Section 3.3.5) can be specified, along with a
unescaped = %x20-21 / %x23-5B / %x5D-7E character encoding (preferably UTF-8 [STD63]).
escaped = "\" ( DQUOTE / "\" )
Strings are delimited with double quotes, using a backslash ("\") to When serialised in a textual HTTP field, Strings are delimited with
escape double quotes and backslashes. For example: double quotes, using a backslash ("\") to escape double quotes and
backslashes. For example:
Example-String: "hello world" Example-String: "hello world"
Note that Strings only use DQUOTE as a delimiter; single quotes do Note that Strings only use DQUOTE as a delimiter; single quotes do
not delimit Strings. Furthermore, only DQUOTE and "\" can be not delimit Strings. Furthermore, only DQUOTE and "\" can be
escaped; other characters after "\" MUST cause parsing to fail. escaped; other characters after "\" MUST cause parsing to fail.
Unicode is not directly supported in Strings, because it causes a
number of interoperability issues, and -- with few exceptions --
field values do not require it.
When it is necessary for a field value to convey non-ASCII content, a
Byte Sequence (Section 3.3.5) can be specified, along with a
character encoding (preferably UTF-8 [STD63]).
Parsers MUST support Strings (after any decoding) with at least 1024 Parsers MUST support Strings (after any decoding) with at least 1024
characters. characters.
3.3.4. Tokens 3.3.4. Tokens
Tokens are short textual words; their abstract model is identical to Tokens are short textual words that begin with an alphabetic
their expression in the HTTP field value serialization. character or "*", followed by zero to many token characters, which
are the same as those allowed by the "token" ABNF rule defined in
The ABNF for Tokens is: [HTTP], plus the ":" and "/" characters.
sf-token = ( ALPHA / "*" ) *( tchar / ":" / "/" )
For example: For example:
Example-Token: foo123/456 Example-Token: foo123/456
Parsers MUST support Tokens with at least 512 characters. Parsers MUST support Tokens with at least 512 characters.
Note that Token allows the same characters as the "token" ABNF rule
defined in [RFC7230], with the exceptions that the first character is
required to be either ALPHA or "*", and ":" and "/" are also allowed
in subsequent characters.
3.3.5. Byte Sequences 3.3.5. Byte Sequences
Byte Sequences can be conveyed in Structured Fields. Byte Sequences can be conveyed in Structured Fields.
The ABNF for a Byte Sequence is: When serialised in a textual HTTP field, a Byte Sequence is delimited
with colons and encoded using base64 ([RFC4648], Section 4). For
sf-binary = ":" *(base64) ":" example:
base64 = ALPHA / DIGIT / "+" / "/" / "="
A Byte Sequence is delimited with colons and encoded using base64
([RFC4648], Section 4). For example:
Example-ByteSequence: :cHJldGVuZCB0aGlzIGlzIGJpbmFyeSBjb250ZW50Lg==: Example-ByteSequence: :cHJldGVuZCB0aGlzIGlzIGJpbmFyeSBjb250ZW50Lg==:
Parsers MUST support Byte Sequences with at least 16384 octets after Parsers MUST support Byte Sequences with at least 16384 octets after
decoding. decoding.
3.3.6. Booleans 3.3.6. Booleans
Boolean values can be conveyed in Structured Fields. Boolean values can be conveyed in Structured Fields.
The ABNF for a Boolean is: When serialised in a textual HTTP field, a Boolean is indicated with
a leading "?" character followed by a "1" for a true value or "0" for
sf-boolean = "?" boolean false. For example:
boolean = "0" / "1"
A Boolean is indicated with a leading "?" character followed by a "1"
for a true value or "0" for false. For example:
Example-Boolean: ?1 Example-Boolean: ?1
Note that in Dictionary (Section 3.2) and Parameter (Section 3.1.2) Note that in Dictionary (Section 3.2) and Parameter (Section 3.1.2)
values, Boolean true is indicated by omitting the value. values, Boolean true is indicated by omitting the value.
3.3.7. Dates
Date values can be conveyed in Structured Fields.
Dates have a data model that is similar to Integers, representing a
(possibly negative) delta in seconds from January 1, 1970 00:00:00
UTC, excluding leap seconds.
For example:
Example-Date: @1659578233
4. Working with Structured Fields in HTTP 4. Working with Structured Fields in HTTP
This section defines how to serialize and parse Structured Fields in This section defines how to serialize and parse Structured Fields in
textual HTTP field values and other encodings compatible with them textual HTTP field values and other encodings compatible with them
(e.g., in HTTP/2 [RFC7540] before compression with HPACK [RFC7541]). (e.g., in HTTP/2 [RFC9113] before compression with HPACK [HPACK]).
4.1. Serializing Structured Fields 4.1. Serializing Structured Fields
Given a structure defined in this specification, return an ASCII Given a structure defined in this specification, return an ASCII
string suitable for use in an HTTP field value. string suitable for use in an HTTP field value.
1. If the structure is a Dictionary or List and its value is empty 1. If the structure is a Dictionary or List and its value is empty
(i.e., it has no members), do not serialize the field at all (i.e., it has no members), do not serialize the field at all
(i.e., omit both the field-name and field-value). (i.e., omit both the field-name and field-value).
skipping to change at page 19, line 36 skipping to change at page 18, line 33
4. If input_item is a Token, return the result of running 4. If input_item is a Token, return the result of running
Serializing a Token (Section 4.1.7) with input_item. Serializing a Token (Section 4.1.7) with input_item.
5. If input_item is a Byte Sequence, return the result of running 5. If input_item is a Byte Sequence, return the result of running
Serializing a Byte Sequence (Section 4.1.8) with input_item. Serializing a Byte Sequence (Section 4.1.8) with input_item.
6. If input_item is a Boolean, return the result of running 6. If input_item is a Boolean, return the result of running
Serializing a Boolean (Section 4.1.9) with input_item. Serializing a Boolean (Section 4.1.9) with input_item.
7. Otherwise, fail serialization. 7. If input_item is a Date, return the result of running Serializing
a Date (Section 4.1.10) with input_item.
8. Otherwise, fail serialization.
4.1.4. Serializing an Integer 4.1.4. Serializing an Integer
Given an Integer as input_integer, return an ASCII string suitable Given an Integer as input_integer, return an ASCII string suitable
for use in an HTTP field value. for use in an HTTP field value.
1. If input_integer is not an integer in the range of 1. If input_integer is not an integer in the range of
-999,999,999,999,999 to 999,999,999,999,999 inclusive, fail -999,999,999,999,999 to 999,999,999,999,999 inclusive, fail
serialization. serialization.
skipping to change at page 22, line 33 skipping to change at page 21, line 33
2. Let output be an empty string. 2. Let output be an empty string.
3. Append "?" to output. 3. Append "?" to output.
4. If input_boolean is true, append "1" to output. 4. If input_boolean is true, append "1" to output.
5. If input_boolean is false, append "0" to output. 5. If input_boolean is false, append "0" to output.
6. Return output. 6. Return output.
4.1.10. Serialising a Date
Given a Date as input_integer, return an ASCII string suitable for
use in an HTTP field value.
1. Let output be "@".
2. Append to output the result of running Serializing an Integer
with input_date (Section 4.1.4).
3. Return output.
4.2. Parsing Structured Fields 4.2. Parsing Structured Fields
When a receiving implementation parses HTTP fields that are known to When a receiving implementation parses HTTP fields that are known to
be Structured Fields, it is important that care be taken, as there be Structured Fields, it is important that care be taken, as there
are a number of edge cases that can cause interoperability or even are a number of edge cases that can cause interoperability or even
security problems. This section specifies the algorithm for doing security problems. This section specifies the algorithm for doing
so. so.
Given an array of bytes as input_bytes that represent the chosen Given an array of bytes as input_bytes that represent the chosen
field's field-value (which is empty if that field is not present) and field's field-value (which is empty if that field is not present) and
skipping to change at page 23, line 20 skipping to change at page 22, line 33
6. Discard any leading SP characters from input_string. 6. Discard any leading SP characters from input_string.
7. If input_string is not empty, fail parsing. 7. If input_string is not empty, fail parsing.
8. Otherwise, return output. 8. Otherwise, return output.
When generating input_bytes, parsers MUST combine all field lines in When generating input_bytes, parsers MUST combine all field lines in
the same section (header or trailer) that case-insensitively match the same section (header or trailer) that case-insensitively match
the field name into one comma-separated field-value, as per the field name into one comma-separated field-value, as per
[RFC7230], Section 3.2.2; this assures that the entire field value is Section 5.2 of [HTTP]; this assures that the entire field value is
processed correctly. processed correctly.
For Lists and Dictionaries, this has the effect of correctly For Lists and Dictionaries, this has the effect of correctly
concatenating all of the field's lines, as long as individual members concatenating all of the field's lines, as long as individual members
of the top-level data structure are not split across multiple header of the top-level data structure are not split across multiple header
instances. The parsing algorithms for both types allow tab instances. The parsing algorithms for both types allow tab
characters, since these might be used to combine field lines by some characters, since these might be used to combine field lines by some
implementations. implementations.
Strings split across multiple field lines will have unpredictable Strings split across multiple field lines will have unpredictable
skipping to change at page 27, line 37 skipping to change at page 26, line 49
the result of running Parsing a Token (Section 4.2.6) with the result of running Parsing a Token (Section 4.2.6) with
input_string. input_string.
4. If the first character of input_string is ":", return the result 4. If the first character of input_string is ":", return the result
of running Parsing a Byte Sequence (Section 4.2.7) with of running Parsing a Byte Sequence (Section 4.2.7) with
input_string. input_string.
5. If the first character of input_string is "?", return the result 5. If the first character of input_string is "?", return the result
of running Parsing a Boolean (Section 4.2.8) with input_string. of running Parsing a Boolean (Section 4.2.8) with input_string.
6. Otherwise, the item type is unrecognized; fail parsing. 6. If the first character of input_string is "@", return the result
of running Parsing a Date (Section 4.2.9) with input_string.
7. Otherwise, the item type is unrecognized; fail parsing.
4.2.3.2. Parsing Parameters 4.2.3.2. Parsing Parameters
Given an ASCII string as input_string, return an ordered map whose Given an ASCII string as input_string, return an ordered map whose
values are bare Items. input_string is modified to remove the parsed values are bare Items. input_string is modified to remove the parsed
value. value.
1. Let parameters be an empty, ordered map. 1. Let parameters be an empty, ordered map.
2. While input_string is not empty: 2. While input_string is not empty:
skipping to change at page 32, line 43 skipping to change at page 32, line 10
2. Discard the first character of input_string. 2. Discard the first character of input_string.
3. If the first character of input_string matches "1", discard the 3. If the first character of input_string matches "1", discard the
first character, and return true. first character, and return true.
4. If the first character of input_string matches "0", discard the 4. If the first character of input_string matches "0", discard the
first character, and return false. first character, and return false.
5. No value has matched; fail parsing. 5. No value has matched; fail parsing.
4.2.9. Parsing a Date
Given an ASCII string as input_string, return a Date. input_string is
modified to remove the parsed value.
1. If the first character of input_string is not "@", fail parsing.
2. Discard the first character of input_string.
3. Let output_date be the result of running Parsing an Integer or
Decimal (Section 4.2.4) with input_string.
4. If output_date is a Decimal, fail parsing.
5. Return output_date.
5. IANA Considerations 5. IANA Considerations
This document has no IANA actions. This document has no IANA actions.
6. Security Considerations 6. Security Considerations
The size of most types defined by Structured Fields is not limited; The size of most types defined by Structured Fields is not limited;
as a result, extremely large fields could be an attack vector (e.g., as a result, extremely large fields could be an attack vector (e.g.,
for resource consumption). Most HTTP implementations limit the sizes for resource consumption). Most HTTP implementations limit the sizes
of individual fields as well as the overall header or trailer section of individual fields as well as the overall header or trailer section
skipping to change at page 33, line 16 skipping to change at page 32, line 47
It is possible for parties with the ability to inject new HTTP fields It is possible for parties with the ability to inject new HTTP fields
to change the meaning of a Structured Field. In some circumstances, to change the meaning of a Structured Field. In some circumstances,
this will cause parsing to fail, but it is not possible to reliably this will cause parsing to fail, but it is not possible to reliably
fail in all such circumstances. fail in all such circumstances.
7. References 7. References
7.1. Normative References 7.1. Normative References
[HTTP] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke,
Ed., "HTTP Semantics", STD 97, RFC 9110,
DOI 10.17487/RFC9110, June 2022,
<https://www.rfc-editor.org/info/rfc9110>.
[RFC0020] Cerf, V., "ASCII format for network interchange", STD 80, [RFC0020] Cerf, V., "ASCII format for network interchange", STD 80,
RFC 20, DOI 10.17487/RFC0020, October 1969, RFC 20, DOI 10.17487/RFC0020, October 1969,
<https://www.rfc-editor.org/info/rfc20>. <https://www.rfc-editor.org/info/rfc20>.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997, DOI 10.17487/RFC2119, March 1997,
<https://www.rfc-editor.org/info/rfc2119>. <https://www.rfc-editor.org/info/rfc2119>.
[RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data
Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006, Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006,
<https://www.rfc-editor.org/info/rfc4648>. <https://www.rfc-editor.org/info/rfc4648>.
[RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax
Specifications: ABNF", STD 68, RFC 5234,
DOI 10.17487/RFC5234, January 2008,
<https://www.rfc-editor.org/info/rfc5234>.
[RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer
Protocol (HTTP/1.1): Message Syntax and Routing", Protocol (HTTP/1.1): Message Syntax and Routing",
RFC 7230, DOI 10.17487/RFC7230, June 2014, RFC 7230, DOI 10.17487/RFC7230, June 2014,
<https://www.rfc-editor.org/info/rfc7230>. <https://www.rfc-editor.org/info/rfc7230>.
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
May 2017, <https://www.rfc-editor.org/info/rfc8174>. May 2017, <https://www.rfc-editor.org/info/rfc8174>.
7.2. Informative References 7.2. Informative References
[HPACK] Peon, R. and H. Ruellan, "HPACK: Header Compression for
HTTP/2", RFC 7541, DOI 10.17487/RFC7541, May 2015,
<https://www.rfc-editor.org/info/rfc7541>.
[IEEE754] IEEE, "IEEE Standard for Floating-Point Arithmetic", [IEEE754] IEEE, "IEEE Standard for Floating-Point Arithmetic",
IEEE 754-2019, DOI 10.1109/IEEESTD.2019.8766229, IEEE 754-2019, DOI 10.1109/IEEESTD.2019.8766229,
ISBN 978-1-5044-5924-2, July 2019, ISBN 978-1-5044-5924-2, July 2019,
<https://ieeexplore.ieee.org/document/8766229>. <https://ieeexplore.ieee.org/document/8766229>.
[RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax
Protocol (HTTP/1.1): Semantics and Content", RFC 7231, Specifications: ABNF", STD 68, RFC 5234,
DOI 10.17487/RFC7231, June 2014, DOI 10.17487/RFC5234, January 2008,
<https://www.rfc-editor.org/info/rfc7231>. <https://www.rfc-editor.org/info/rfc5234>.
[RFC7493] Bray, T., Ed., "The I-JSON Message Format", RFC 7493, [RFC7493] Bray, T., Ed., "The I-JSON Message Format", RFC 7493,
DOI 10.17487/RFC7493, March 2015, DOI 10.17487/RFC7493, March 2015,
<https://www.rfc-editor.org/info/rfc7493>. <https://www.rfc-editor.org/info/rfc7493>.
[RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext
Transfer Protocol Version 2 (HTTP/2)", RFC 7540,
DOI 10.17487/RFC7540, May 2015,
<https://www.rfc-editor.org/info/rfc7540>.
[RFC7541] Peon, R. and H. Ruellan, "HPACK: Header Compression for
HTTP/2", RFC 7541, DOI 10.17487/RFC7541, May 2015,
<https://www.rfc-editor.org/info/rfc7541>.
[RFC8259] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data [RFC8259] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data
Interchange Format", STD 90, RFC 8259, Interchange Format", STD 90, RFC 8259,
DOI 10.17487/RFC8259, December 2017, DOI 10.17487/RFC8259, December 2017,
<https://www.rfc-editor.org/info/rfc8259>. <https://www.rfc-editor.org/info/rfc8259>.
[RFC9113] Thomson, M., Ed. and C. Benfield, Ed., "HTTP/2", RFC 9113,
DOI 10.17487/RFC9113, June 2022,
<https://www.rfc-editor.org/info/rfc9113>.
[STD63] Yergeau, F., "UTF-8, a transformation format of ISO [STD63] Yergeau, F., "UTF-8, a transformation format of ISO
10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November
2003, <http://www.rfc-editor.org/info/std63>. 2003, <http://www.rfc-editor.org/info/std63>.
Appendix A. Frequently Asked Questions Appendix A. Frequently Asked Questions
A.1. Why Not JSON? A.1. Why Not JSON?
Earlier proposals for Structured Fields were based upon JSON Earlier proposals for Structured Fields were based upon JSON
[RFC8259]. However, constraining its use to make it suitable for [RFC8259]. However, constraining its use to make it suitable for
skipping to change at page 36, line 7 skipping to change at page 35, line 38
The serialization algorithm is defined in a way that it is not The serialization algorithm is defined in a way that it is not
strictly limited to the data types defined in Section 3 in every strictly limited to the data types defined in Section 3 in every
case. For example, Decimals are designed to take broader input and case. For example, Decimals are designed to take broader input and
round to allowed values. round to allowed values.
Implementations are allowed to limit the size of different Implementations are allowed to limit the size of different
structures, subject to the minimums defined for each type. When a structures, subject to the minimums defined for each type. When a
structure exceeds an implementation limit, that structure fails structure exceeds an implementation limit, that structure fails
parsing or serialization. parsing or serialization.
Appendix C. ABNF
This section uses the Augmented Backus-Naur Form (ABNF) notation
[RFC5234] to illustrate expected syntax of Structured Fields. In
doing so, it uses the VCHAR, SP, DIGIT, ALPHA, and DQUOTE rules from
[RFC5234]. It also includes the tchar and OWS rules from [RFC7230].
This section is non-normative. If there is disagreement between the
parsing algorithms and ABNF, the specified algorithms take
precedence.
sf-list = list-member *( OWS "," OWS list-member )
list-member = sf-item / inner-list
inner-list = "(" *SP [ sf-item *( 1*SP sf-item ) *SP ] ")"
parameters
parameters = *( ";" *SP parameter )
parameter = param-key [ "=" param-value ]
param-key = key
key = ( lcalpha / "*" )
*( lcalpha / DIGIT / "_" / "-" / "." / "*" )
lcalpha = %x61-7A ; a-z
param-value = bare-item
sf-dictionary = dict-member *( OWS "," OWS dict-member )
dict-member = member-key ( parameters / ( "=" member-value ))
member-key = key
member-value = sf-item / inner-list
sf-item = bare-item parameters
bare-item = sf-integer / sf-decimal / sf-string / sf-token
/ sf-binary / sf-boolean
sf-integer = ["-"] 1*15DIGIT
sf-decimal = ["-"] 1*12DIGIT "." 1*3DIGIT
sf-string = DQUOTE *chr DQUOTE
chr = unescaped / escaped
unescaped = %x20-21 / %x23-5B / %x5D-7E
escaped = "\" ( DQUOTE / "\" )
sf-token = ( ALPHA / "*" ) *( tchar / ":" / "/" )
sf-binary = ":" *(base64) ":"
base64 = ALPHA / DIGIT / "+" / "/" / "="
sf-boolean = "?" boolean
boolean = "0" / "1"
sf-date = "@" ["-"] 1*15DIGIT
Appendix D. Changes from RFC 8941
This revision of the Structured Field Values for HTTP specification
has made the following changes:
o Added the Date structured type. (Section 3.3.7)
o Stopped encouraging use of ABNF in definitions of new structured
fields. (Section 2)
o Moved ABNF to an informative appendix. (Appendix C)
Acknowledgements Acknowledgements
Many thanks to Matthew Kerwin for his detailed feedback and careful Many thanks to Matthew Kerwin for his detailed feedback and careful
consideration during the development of this specification. consideration during the development of this specification.
Thanks also to Ian Clelland, Roy Fielding, Anne van Kesteren, Kazuho Thanks also to Ian Clelland, Roy Fielding, Anne van Kesteren, Kazuho
Oku, Evert Pot, Julian Reschke, Martin Thomson, Mike West, and Oku, Evert Pot, Julian Reschke, Martin Thomson, Mike West, and
Jeffrey Yasskin for their contributions. Jeffrey Yasskin for their contributions.
Authors' Addresses Authors' Addresses
 End of changes. 55 change blocks. 
188 lines changed or deleted 232 lines changed or added

This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/