draft-ietf-httpbis-header-structure-16.txt   draft-ietf-httpbis-header-structure-17.txt 
HTTP M. Nottingham HTTP M. Nottingham
Internet-Draft Fastly Internet-Draft Fastly
Intended status: Standards Track P-H. Kamp Intended status: Standards Track P-H. Kamp
Expires: September 10, 2020 The Varnish Cache Project Expires: September 16, 2020 The Varnish Cache Project
March 9, 2020 March 15, 2020
Structured Field Values for HTTP Structured Field Values for HTTP
draft-ietf-httpbis-header-structure-16 draft-ietf-httpbis-header-structure-17
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", or HTTP header and trailer fields, known as "Structured Fields", or
"Structured Headers". It is intended for use by specifications of "Structured Headers". It is intended for use by specifications of
new HTTP fields that wish to use a common syntax that is more new HTTP fields that wish to use a common syntax that is more
restrictive than traditional HTTP field values. restrictive than traditional HTTP field values.
skipping to change at page 2, line 10 skipping to change at page 2, line 10
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 September 10, 2020. This Internet-Draft will expire on September 16, 2020.
Copyright Notice Copyright Notice
Copyright (c) 2020 IETF Trust and the persons identified as the Copyright (c) 2020 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 34 skipping to change at page 2, line 34
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
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 . . . . . . . . . . . . . . . . . 5 1.2. Notational Conventions . . . . . . . . . . . . . . . . . 5
2. Defining New Structured Fields . . . . . . . . . . . . . . . 5 2. Defining New Structured Fields . . . . . . . . . . . . . . . 5
3. Structured Data Types . . . . . . . . . . . . . . . . . . . . 8 3. Structured Data Types . . . . . . . . . . . . . . . . . . . . 8
3.1. Lists . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.1. Lists . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1.1. Inner Lists . . . . . . . . . . . . . . . . . . . . . 9 3.1.1. Inner Lists . . . . . . . . . . . . . . . . . . . . . 9
3.1.2. Parameters . . . . . . . . . . . . . . . . . . . . . 9 3.1.2. Parameters . . . . . . . . . . . . . . . . . . . . . 10
3.2. Dictionaries . . . . . . . . . . . . . . . . . . . . . . 10 3.2. Dictionaries . . . . . . . . . . . . . . . . . . . . . . 11
3.3. Items . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.3. Items . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.3.1. Integers . . . . . . . . . . . . . . . . . . . . . . 12 3.3.1. Integers . . . . . . . . . . . . . . . . . . . . . . 13
3.3.2. Decimals . . . . . . . . . . . . . . . . . . . . . . 12 3.3.2. Decimals . . . . . . . . . . . . . . . . . . . . . . 13
3.3.3. Strings . . . . . . . . . . . . . . . . . . . . . . . 13 3.3.3. Strings . . . . . . . . . . . . . . . . . . . . . . . 13
3.3.4. Tokens . . . . . . . . . . . . . . . . . . . . . . . 14 3.3.4. Tokens . . . . . . . . . . . . . . . . . . . . . . . 14
3.3.5. Byte Sequences . . . . . . . . . . . . . . . . . . . 14 3.3.5. Byte Sequences . . . . . . . . . . . . . . . . . . . 14
3.3.6. Booleans . . . . . . . . . . . . . . . . . . . . . . 14 3.3.6. Booleans . . . . . . . . . . . . . . . . . . . . . . 15
4. Working With Structured Fields in HTTP . . . . . . . . . . . 15 4. Working With Structured Fields in HTTP . . . . . . . . . . . 15
4.1. Serializing Structured Fields . . . . . . . . . . . . . . 15 4.1. Serializing Structured Fields . . . . . . . . . . . . . . 15
4.1.1. Serializing a List . . . . . . . . . . . . . . . . . 15 4.1.1. Serializing a List . . . . . . . . . . . . . . . . . 16
4.1.2. Serializing a Dictionary . . . . . . . . . . . . . . 17 4.1.2. Serializing a Dictionary . . . . . . . . . . . . . . 18
4.1.3. Serializing an Item . . . . . . . . . . . . . . . . . 18 4.1.3. Serializing an Item . . . . . . . . . . . . . . . . . 18
4.1.4. Serializing an Integer . . . . . . . . . . . . . . . 19 4.1.4. Serializing an Integer . . . . . . . . . . . . . . . 19
4.1.5. Serializing a Decimal . . . . . . . . . . . . . . . . 19 4.1.5. Serializing a Decimal . . . . . . . . . . . . . . . . 20
4.1.6. Serializing a String . . . . . . . . . . . . . . . . 20 4.1.6. Serializing a String . . . . . . . . . . . . . . . . 20
4.1.7. Serializing a Token . . . . . . . . . . . . . . . . . 20 4.1.7. Serializing a Token . . . . . . . . . . . . . . . . . 21
4.1.8. Serializing a Byte Sequence . . . . . . . . . . . . . 21 4.1.8. Serializing a Byte Sequence . . . . . . . . . . . . . 21
4.1.9. Serializing a Boolean . . . . . . . . . . . . . . . . 21 4.1.9. Serializing a Boolean . . . . . . . . . . . . . . . . 22
4.2. Parsing Structured Fields . . . . . . . . . . . . . . . . 22 4.2. Parsing Structured Fields . . . . . . . . . . . . . . . . 22
4.2.1. Parsing a List . . . . . . . . . . . . . . . . . . . 23 4.2.1. Parsing a List . . . . . . . . . . . . . . . . . . . 24
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 . . . . . . . . . . . . 28 4.2.4. Parsing an Integer or Decimal . . . . . . . . . . . . 28
4.2.5. Parsing a String . . . . . . . . . . . . . . . . . . 29 4.2.5. Parsing a String . . . . . . . . . . . . . . . . . . 30
4.2.6. Parsing a Token . . . . . . . . . . . . . . . . . . . 30 4.2.6. Parsing a Token . . . . . . . . . . . . . . . . . . . 30
4.2.7. Parsing a Byte Sequence . . . . . . . . . . . . . . . 30 4.2.7. Parsing a Byte Sequence . . . . . . . . . . . . . . . 31
4.2.8. Parsing a Boolean . . . . . . . . . . . . . . . . . . 31 4.2.8. Parsing a Boolean . . . . . . . . . . . . . . . . . . 32
5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 32 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 32
6. Security Considerations . . . . . . . . . . . . . . . . . . . 32 6. Security Considerations . . . . . . . . . . . . . . . . . . . 32
7. References . . . . . . . . . . . . . . . . . . . . . . . . . 32 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 32
7.1. Normative References . . . . . . . . . . . . . . . . . . 32 7.1. Normative References . . . . . . . . . . . . . . . . . . 32
7.2. Informative References . . . . . . . . . . . . . . . . . 33 7.2. Informative References . . . . . . . . . . . . . . . . . 33
7.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 33 7.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 34
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 . . . . . . . . . . . . . . . . 34 Appendix B. Implementation Notes . . . . . . . . . . . . . . . . 35
Appendix C. Changes . . . . . . . . . . . . . . . . . . . . . . 35 Appendix C. Changes . . . . . . . . . . . . . . . . . . . . . . 35
C.1. Since draft-ietf-httpbis-header-structure-15 . . . . . . 35 C.1. Since draft-ietf-httpbis-header-structure-15 . . . . . . 36
C.2. Since draft-ietf-httpbis-header-structure-14 . . . . . . 35 C.2. Since draft-ietf-httpbis-header-structure-14 . . . . . . 36
C.3. Since draft-ietf-httpbis-header-structure-13 . . . . . . 36 C.3. Since draft-ietf-httpbis-header-structure-13 . . . . . . 37
C.4. Since draft-ietf-httpbis-header-structure-12 . . . . . . 36 C.4. Since draft-ietf-httpbis-header-structure-12 . . . . . . 37
C.5. Since draft-ietf-httpbis-header-structure-11 . . . . . . 37 C.5. Since draft-ietf-httpbis-header-structure-11 . . . . . . 37
C.6. Since draft-ietf-httpbis-header-structure-10 . . . . . . 37 C.6. Since draft-ietf-httpbis-header-structure-10 . . . . . . 37
C.7. Since draft-ietf-httpbis-header-structure-09 . . . . . . 37 C.7. Since draft-ietf-httpbis-header-structure-09 . . . . . . 38
C.8. Since draft-ietf-httpbis-header-structure-08 . . . . . . 37 C.8. Since draft-ietf-httpbis-header-structure-08 . . . . . . 38
C.9. Since draft-ietf-httpbis-header-structure-07 . . . . . . 38 C.9. Since draft-ietf-httpbis-header-structure-07 . . . . . . 38
C.10. Since draft-ietf-httpbis-header-structure-06 . . . . . . 38 C.10. Since draft-ietf-httpbis-header-structure-06 . . . . . . 39
C.11. Since draft-ietf-httpbis-header-structure-05 . . . . . . 38 C.11. Since draft-ietf-httpbis-header-structure-05 . . . . . . 39
C.12. Since draft-ietf-httpbis-header-structure-04 . . . . . . 39 C.12. Since draft-ietf-httpbis-header-structure-04 . . . . . . 39
C.13. Since draft-ietf-httpbis-header-structure-03 . . . . . . 39 C.13. Since draft-ietf-httpbis-header-structure-03 . . . . . . 39
C.14. Since draft-ietf-httpbis-header-structure-02 . . . . . . 39 C.14. Since draft-ietf-httpbis-header-structure-02 . . . . . . 39
C.15. Since draft-ietf-httpbis-header-structure-01 . . . . . . 39 C.15. Since draft-ietf-httpbis-header-structure-01 . . . . . . 40
C.16. Since draft-ietf-httpbis-header-structure-00 . . . . . . 39 C.16. Since draft-ietf-httpbis-header-structure-00 . . . . . . 40
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 40 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 40
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 40 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 40
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 8.3.1 of [RFC7231],
there are many decisions - and pitfalls - for a prospective HTTP there are many decisions - and pitfalls - for a prospective HTTP
field author. field author.
skipping to change at page 6, line 21 skipping to change at page 6, line 21
well as the consequences when those constraints are violated. well as the consequences when those constraints are violated.
Typically, this means that a field definition will specify the top- Typically, this means that a field definition will specify the top-
level type - List, Dictionary or Item - and then define its allowable level type - List, Dictionary or Item - and then define its allowable
types, and constraints upon them. For example, a header defined as a types, and constraints upon them. For example, a header defined as a
List might have all Integer members, or a mix of types; a header List might have all Integer members, or a mix of types; a header
defined as an Item might allow only Strings, and additionally only defined as an Item might allow only Strings, and additionally only
strings beginning with the letter "Q". Likewise, Inner Lists are strings beginning with the letter "Q". Likewise, Inner Lists are
only valid when a field definition explicitly allows them. only valid when a field definition explicitly allows them.
When parsing fails, the field is ignored (see Section 4.2); in most When parsing fails, the entire field is ignored (see Section 4.2); in
situations, violating field-specific constraints should have the same most situations, violating field-specific constraints should have the
effect. Thus, if a header is defined as an Item and required to be same effect. Thus, if a header is defined as an Item and required to
an Integer, but a String is received, it will by default be ignored. be an Integer, but a String is received, the field will by default be
If the field requires different error handling, this should be ignored. If the field requires different error handling, this should
explicitly specified. be explicitly specified.
However, both Items and Inner Lists allow parameters as an Both Items and Inner Lists allow parameters as an extensibility
extensibility mechanism; this means that values can later be extended mechanism; this means that values can later be extended to
to accommodate more information, if need be. As a result, field accommodate more information, if need be. To preserve forward
specifications are discouraged from defining the presence of an compatibility, field specifications are discouraged from defining the
unrecognized Parameter as an error condition. presence of an unrecognized Parameter as an error condition.
To help assure that this extensibility is available in the future, To further assure that this extensibility is available in the future,
and to encourage consumers to use a complete parser implementation, a and to encourage consumers to use a complete parser implementation, a
field definition can specify that "grease" Parameters be added by field definition can specify that "grease" Parameters be added by
senders. For example, a specification could stipulate that all senders. A specification could stipulate that all Parameters that
Parameters beginning with the letter "h" are reserved for this use, fit a defined pattern are reserved for this use and then encourage
and then encourage them to be sent on some portion of requests. This them to be sent on some portion of requests. This helps to
helps to discourage recipients from writing a parser that does not discourage recipients from writing a parser that does not account for
account for Parameters. Parameters.
Note that a field definition cannot relax the requirements of this Specifications that use Dictionaries can also allow for forward
compatibility by requiring that the presence of - as well as value
and type associated with - unknown members be ignored. Later
specifications can then add additional members, specifying
constraints on them as appropriate.
An extension to a structured field can then require that an entire
field value be ignored by a recipient that understands the extension
if constraints on the value it defines are not met.
A field definition cannot relax the requirements of this
specification because doing so would preclude handling by generic specification because doing so would preclude handling by generic
software; they can only add additional constraints (for example, on software; they can only add additional constraints (for example, on
the numeric range of Integers and Decimals, the format of Strings and the numeric range of Integers and Decimals, the format of Strings and
Tokens, the types allowed in a Dictionary's values, or the number of Tokens, the types allowed in a Dictionary's values, or the number of
Items in a List). Likewise, field definitions can only use this Items in a List). Likewise, field definitions can only use this
specification for the entire field value, not a portion thereof. specification for the entire field value, not a portion thereof.
This specification defines minimums for the length or number of This specification defines minimums for the length or number of
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
skipping to change at page 7, line 32 skipping to change at page 8, line 17
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 a Item Structured Header [RFCxxxx]. Its value MUST be Foo-Example is a Item Structured Header [RFCxxxx]. Its value MUST be
an Integer (Section Y.Y of [RFCxxxx]). Its ABNF is: an Integer (Section Y.Y of [RFCxxxx]). Its ABNF is:
Foo-Example = sh-integer Foo-Example = sh-integer
Its value indicates the amount of Foo in the message, and MUST Its value indicates the amount of Foo in the message, and MUST
be between 0 and 10, inclusive; other values MUST cause be between 0 and 10, inclusive; other values MUST cause
the entire header to be ignored. the entire header field to be ignored.
The following parameters are defined: The following parameters are defined:
* A Parameter whose name is "foourl", and whose value is a String * A Parameter whose name is "foourl", and whose value is a String
(Section Y.Y of [RFCxxxx]), conveying the Foo URL (Section Y.Y of [RFCxxxx]), conveying the Foo URL
for the message. See below for processing requirements. for the message. See below for processing requirements.
"foourl" contains a URI-reference (Section 4.1 of "foourl" contains a URI-reference (Section 4.1 of [RFC3986]). If
[RFC3986]). If its value is not a valid URI-reference, its value is not a valid URI-reference, the entire header field
it MUST be ignored. If its value is a relative reference MUST be ignored. If its value is a relative reference (Section 4.2
(Section 4.2 of [RFC3986]), it MUST be resolved (Section 5 of of [RFC3986]), it MUST be resolved (Section 5 of [RFC3986]) before
[RFC3986]) before being used. 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 value types that can be composed This section defines the abstract value types that can be composed
into Structured Fields. The ABNF provided represents the on-wire into Structured Fields. The ABNF provided represents the on-wire
format in HTTP field values. format in HTTP field values.
 End of changes. 27 change blocks. 
55 lines changed or deleted 65 lines changed or added

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