| draft-ietf-httpbis-header-structure-11.txt | draft-ietf-httpbis-header-structure-12.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: January 9, 2020 The Varnish Cache Project | Expires: February 20, 2020 The Varnish Cache Project | |||
| July 8, 2019 | August 19, 2019 | |||
| Structured Headers for HTTP | Structured Headers for HTTP | |||
| draft-ietf-httpbis-header-structure-11 | draft-ietf-httpbis-header-structure-12 | |||
| 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 fields. It is intended for use by specifications of new | HTTP header fields. It is intended for use by specifications of new | |||
| HTTP header fields that wish to use a common syntax that is more | HTTP header fields that wish to use a common syntax that is more | |||
| restrictive than traditional HTTP field values. | restrictive than traditional HTTP field values. | |||
| Note to Readers | Note to Readers | |||
| 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 January 9, 2020. | This Internet-Draft will expire on February 20, 2020. | |||
| Copyright Notice | Copyright Notice | |||
| Copyright (c) 2019 IETF Trust and the persons identified as the | Copyright (c) 2019 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 35 ¶ | skipping to change at page 2, line 35 ¶ | |||
| 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 Headers . . . . . . . . . . . . . . . 5 | 2. Defining New Structured Headers . . . . . . . . . . . . . . . 5 | |||
| 3. Structured Header Data Types . . . . . . . . . . . . . . . . 6 | 3. Structured Header Data Types . . . . . . . . . . . . . . . . 6 | |||
| 3.1. Lists . . . . . . . . . . . . . . . . . . . . . . . . . . 6 | 3.1. Lists . . . . . . . . . . . . . . . . . . . . . . . . . . 6 | |||
| 3.2. Dictionaries . . . . . . . . . . . . . . . . . . . . . . 7 | 3.2. Dictionaries . . . . . . . . . . . . . . . . . . . . . . 8 | |||
| 3.3. Items . . . . . . . . . . . . . . . . . . . . . . . . . . 8 | 3.3. Items . . . . . . . . . . . . . . . . . . . . . . . . . . 9 | |||
| 3.4. Integers . . . . . . . . . . . . . . . . . . . . . . . . 8 | 3.4. Integers . . . . . . . . . . . . . . . . . . . . . . . . 9 | |||
| 3.5. Floats . . . . . . . . . . . . . . . . . . . . . . . . . 9 | 3.5. Floats . . . . . . . . . . . . . . . . . . . . . . . . . 9 | |||
| 3.6. Strings . . . . . . . . . . . . . . . . . . . . . . . . . 9 | 3.6. Strings . . . . . . . . . . . . . . . . . . . . . . . . . 10 | |||
| 3.7. Tokens . . . . . . . . . . . . . . . . . . . . . . . . . 10 | 3.7. Tokens . . . . . . . . . . . . . . . . . . . . . . . . . 10 | |||
| 3.8. Byte Sequences . . . . . . . . . . . . . . . . . . . . . 10 | 3.8. Byte Sequences . . . . . . . . . . . . . . . . . . . . . 11 | |||
| 3.9. Booleans . . . . . . . . . . . . . . . . . . . . . . . . 11 | 3.9. Booleans . . . . . . . . . . . . . . . . . . . . . . . . 11 | |||
| 4. Working With Structured Headers in Textual HTTP Headers . . . 11 | 4. Working With Structured Headers in Textual HTTP Headers . . . 11 | |||
| 4.1. Serializing Structured Headers . . . . . . . . . . . . . 11 | 4.1. Serializing Structured Headers . . . . . . . . . . . . . 11 | |||
| 4.2. Parsing Header Fields into Structured Headers . . . . . . 17 | 4.2. Parsing Header Fields into Structured Headers . . . . . . 18 | |||
| 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 26 | 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 27 | |||
| 6. Security Considerations . . . . . . . . . . . . . . . . . . . 26 | 6. Security Considerations . . . . . . . . . . . . . . . . . . . 27 | |||
| 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 26 | 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 27 | |||
| 7.1. Normative References . . . . . . . . . . . . . . . . . . 26 | 7.1. Normative References . . . . . . . . . . . . . . . . . . 27 | |||
| 7.2. Informative References . . . . . . . . . . . . . . . . . 27 | 7.2. Informative References . . . . . . . . . . . . . . . . . 28 | |||
| 7.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 28 | 7.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 28 | |||
| Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 28 | Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 29 | |||
| Appendix B. Frequently Asked Questions . . . . . . . . . . . . . 28 | Appendix B. Frequently Asked Questions . . . . . . . . . . . . . 29 | |||
| B.1. Why not JSON? . . . . . . . . . . . . . . . . . . . . . . 28 | B.1. Why not JSON? . . . . . . . . . . . . . . . . . . . . . . 29 | |||
| B.2. Structured Headers don't "fit" my data. . . . . . . . . . 29 | B.2. Structured Headers don't "fit" my data. . . . . . . . . . 30 | |||
| Appendix C. Implementation Notes . . . . . . . . . . . . . . . . 29 | Appendix C. Implementation Notes . . . . . . . . . . . . . . . . 30 | |||
| Appendix D. Changes . . . . . . . . . . . . . . . . . . . . . . 30 | Appendix D. Changes . . . . . . . . . . . . . . . . . . . . . . 31 | |||
| D.1. Since draft-ietf-httpbis-header-structure-10 . . . . . . 30 | D.1. Since draft-ietf-httpbis-header-structure-11 . . . . . . 31 | |||
| D.2. Since draft-ietf-httpbis-header-structure-09 . . . . . . 30 | D.2. Since draft-ietf-httpbis-header-structure-10 . . . . . . 31 | |||
| D.3. Since draft-ietf-httpbis-header-structure-08 . . . . . . 31 | D.3. Since draft-ietf-httpbis-header-structure-09 . . . . . . 31 | |||
| D.4. Since draft-ietf-httpbis-header-structure-07 . . . . . . 31 | D.4. Since draft-ietf-httpbis-header-structure-08 . . . . . . 31 | |||
| D.5. Since draft-ietf-httpbis-header-structure-06 . . . . . . 32 | D.5. Since draft-ietf-httpbis-header-structure-07 . . . . . . 32 | |||
| D.6. Since draft-ietf-httpbis-header-structure-05 . . . . . . 32 | D.6. Since draft-ietf-httpbis-header-structure-06 . . . . . . 32 | |||
| D.7. Since draft-ietf-httpbis-header-structure-04 . . . . . . 32 | D.7. Since draft-ietf-httpbis-header-structure-05 . . . . . . 32 | |||
| D.8. Since draft-ietf-httpbis-header-structure-03 . . . . . . 32 | D.8. Since draft-ietf-httpbis-header-structure-04 . . . . . . 33 | |||
| D.9. Since draft-ietf-httpbis-header-structure-02 . . . . . . 32 | D.9. Since draft-ietf-httpbis-header-structure-03 . . . . . . 33 | |||
| D.10. Since draft-ietf-httpbis-header-structure-01 . . . . . . 33 | D.10. Since draft-ietf-httpbis-header-structure-02 . . . . . . 33 | |||
| D.11. Since draft-ietf-httpbis-header-structure-00 . . . . . . 33 | D.11. Since draft-ietf-httpbis-header-structure-01 . . . . . . 33 | |||
| Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 33 | D.12. Since draft-ietf-httpbis-header-structure-00 . . . . . . 33 | |||
| Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 34 | ||||
| 1. Introduction | 1. Introduction | |||
| Specifying the syntax of new HTTP header fields is an onerous task; | Specifying the syntax of new HTTP header fields is an onerous task; | |||
| even with the guidance in [RFC7231], Section 8.3.1, there are many | even with the guidance in [RFC7231], Section 8.3.1, there are many | |||
| decisions - and pitfalls - for a prospective HTTP header field | decisions - and pitfalls - for a prospective HTTP header field | |||
| author. | author. | |||
| Once a header field is defined, bespoke parsers and serializers often | Once a header field is defined, bespoke parsers and serializers often | |||
| need to be written, because each header has slightly different | need to be written, because each header has slightly different | |||
| skipping to change at page 7, line 12 ¶ | skipping to change at page 7, line 14 ¶ | |||
| more parameters on a member, and their keys are required to be unique | more parameters on a member, and their keys are required to be unique | |||
| within that scope. | within that scope. | |||
| The ABNF for lists is: | The ABNF for lists is: | |||
| sh-list = list-member *( OWS "," OWS list-member ) | sh-list = list-member *( OWS "," OWS list-member ) | |||
| list-member = ( sh-item / inner-list ) *parameter | list-member = ( sh-item / inner-list ) *parameter | |||
| inner-list = "(" OWS [ sh-item *( SP sh-item ) OWS ] ")" | inner-list = "(" OWS [ sh-item *( SP sh-item ) OWS ] ")" | |||
| parameter = OWS ";" OWS param-name [ "=" param-value ] | parameter = OWS ";" OWS param-name [ "=" param-value ] | |||
| param-name = key | param-name = key | |||
| key = lcalpha *( lcalpha / DIGIT / "_" / "-" ) | key = lcalpha *( lcalpha / DIGIT / "_" / "-" / "*" ) | |||
| lcalpha = %x61-7A ; a-z | lcalpha = %x61-7A ; a-z | |||
| param-value = sh-item | param-value = sh-item | |||
| In textual HTTP headers, each member is separated by a comma and | In textual HTTP headers, each member is separated by a comma and | |||
| optional whitespace. For example, a header field whose value is | optional whitespace. For example, a header field whose value is | |||
| defined as a list of strings could look like: | defined as a list of strings could look like: | |||
| Example-StrListHeader: "foo", "bar", "It was the best of times." | Example-StrListHeader: "foo", "bar", "It was the best of times." | |||
| In textual HTTP headers, inner lists are denoted by surrounding | In textual HTTP headers, inner lists are denoted by surrounding | |||
| skipping to change at page 7, line 36 ¶ | skipping to change at page 7, line 38 ¶ | |||
| Example-StrListListHeader: ("foo" "bar"), ("baz"), ("bat" "one"), () | Example-StrListListHeader: ("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. | |||
| In textual HTTP headers, members' parameters are separated from the | In textual HTTP headers, members' parameters are separated from the | |||
| member and each other by semicolons. For example: | member and each other by semicolons. For example: | |||
| Example-ParamListHeader: abc_123;a=1;b=2; cdef_456, (ghi jkl);q="9";r="w" | Example-ParamListHeader: abc_123;a=1;b=2; cdef_456, (ghi jkl);q="9";r="w" | |||
| In textual HTTP headers, an empty list is denoted by not serialising | ||||
| the header at all. | ||||
| Parsers MUST support lists containing at least 1024 members, support | Parsers MUST support lists containing at least 1024 members, support | |||
| members with at least 256 parameters, support inner-lists containing | members with at least 256 parameters, support inner-lists containing | |||
| at least 256 members, and support parameter keys with at least 64 | at least 256 members, and support parameter keys with at least 64 | |||
| characters. | characters. | |||
| Header specifications can constrain the types of individual list | Header specifications can constrain the types of individual list | |||
| values (including that of individual inner-list members and | values (including that of individual inner-list members and | |||
| parameters) if necessary. | parameters) if necessary. | |||
| 3.2. Dictionaries | 3.2. Dictionaries | |||
| Dictionaries are ordered maps of name-value pairs, where the names | Dictionaries are ordered maps of name-value pairs, where the names | |||
| are short, textual strings and the values are items (Section 3.3) or | are short, textual strings and the values are items (Section 3.3) or | |||
| arrays of items. There can be zero or more members, and their names | arrays of items. There can be zero or more members, and their names | |||
| are required to be unique within the scope of the dictionary they | are required to be unique within the scope of the dictionary they | |||
| occur within. | occur within. | |||
| Each member of the dictionary can also have associated parameters - | ||||
| an ordered map of key-value pairs where the keys are short, textual | ||||
| strings and the values are items (Section 3.3). There can be zero or | ||||
| more parameters on a member, and their keys are required to be unique | ||||
| within that scope. | ||||
| Implementations MUST provide access to dictionaries both by index and | Implementations MUST provide access to dictionaries both by index and | |||
| by name. Specifications MAY use either means of accessing the | by name. Specifications MAY use either means of accessing the | |||
| members. | members. | |||
| The ABNF for dictionaries in textual HTTP headers is: | The ABNF for dictionaries in textual HTTP headers is: | |||
| sh-dictionary = dict-member *( OWS "," OWS dict-member ) | sh-dictionary = dict-member *( OWS "," OWS dict-member ) | |||
| dict-member = member-name "=" member-value | dict-member = member-name "=" member-value *parameter | |||
| member-name = key | member-name = key | |||
| member-value = sh-item / inner-list | member-value = sh-item / inner-list | |||
| In textual HTTP headers, members are separated by a comma with | In textual HTTP headers, members are separated by a comma with | |||
| optional whitespace, while names and values are separated by "=" | optional whitespace, while names and values are separated by "=" | |||
| (without whitespace). For example: | (without whitespace). For example: | |||
| Example-DictHeader: en="Applepie", da=*w4ZibGV0w6ZydGU=* | Example-DictHeader: en="Applepie", da=*w4ZibGV0w6ZydGU=* | |||
| 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-DictListHeader: rating=1.5, feelings=(joy sadness) | Example-DictListHeader: rating=1.5, feelings=(joy sadness) | |||
| Typically, a header field specification will define the semantics of | A dictionary with a mix of singular and list values, some with | |||
| individual member names, as well as whether their presence is | parameters: | |||
| Example-MixDict: a=(1,2), b=3, c=4;aa=bb, d=(5,6);valid=?T | ||||
| As with lists, an empty dictionary is represented in textual HTTP | ||||
| headers by omitting the entire header field. | ||||
| Typically, a header field specification will define the semantics | ||||
| using individual member names, as well as whether their presence is | ||||
| required or optional. Recipients MUST ignore names that are | required or optional. Recipients MUST ignore names that are | |||
| undefined or unknown, unless the header field's specification | undefined or unknown, unless the header field's specification | |||
| specifically disallows them. | specifically disallows them. | |||
| Parsers MUST support dictionaries containing at least 1024 name/value | Parsers MUST support dictionaries containing at least 1024 name/value | |||
| pairs, and names with at least 64 characters. | pairs, and names with at least 64 characters. | |||
| 3.3. Items | 3.3. Items | |||
| An item is can be a integer (Section 3.4), float (Section 3.5), | An item is can be a integer (Section 3.4), float (Section 3.5), | |||
| skipping to change at page 9, line 16 ¶ | skipping to change at page 9, line 38 ¶ | |||
| For example: | For example: | |||
| Example-IntegerHeader: 42 | Example-IntegerHeader: 42 | |||
| 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.5. Floats | 3.5. Floats | |||
| Floats are integers with a fractional part, that can be stored as | Floats are decimal numbers with an integer and a fractional | |||
| IEEE 754 double precision numbers (binary64) ([IEEE754]). | component. The fractional component has at most six digits of | |||
| precision. Additionally, like integers, it can have no more than | ||||
| fifteen digits in total, which in some cases further constrains its | ||||
| precision. | ||||
| The ABNF for floats in textual HTTP headers is: | The ABNF for floats in textual HTTP headers is: | |||
| sh-float = ["-"] ( | sh-float = ["-"] (1*9DIGIT "." 1*6DIGIT / | |||
| DIGIT "." 1*14DIGIT / | 10DIGIT "." 1*5DIGIT / | |||
| 2DIGIT "." 1*13DIGIT / | 11DIGIT "." 1*4DIGIT / | |||
| 3DIGIT "." 1*12DIGIT / | 12DIGIT "." 1*3DIGIT / | |||
| 4DIGIT "." 1*11DIGIT / | 13DIGIT "." 1*2DIGIT / | |||
| 5DIGIT "." 1*10DIGIT / | 14DIGIT "." 1DIGIT ) | |||
| 6DIGIT "." 1*9DIGIT / | ||||
| 7DIGIT "." 1*8DIGIT / | ||||
| 8DIGIT "." 1*7DIGIT / | ||||
| 9DIGIT "." 1*6DIGIT / | ||||
| 10DIGIT "." 1*5DIGIT / | ||||
| 11DIGIT "." 1*4DIGIT / | ||||
| 12DIGIT "." 1*3DIGIT / | ||||
| 13DIGIT "." 1*2DIGIT / | ||||
| 14DIGIT "." 1DIGIT ) | ||||
| For example, a header whose value is defined as a float could look | For example, a header whose value is defined as a float could look | |||
| like: | like: | |||
| Example-FloatHeader: 4.5 | Example-FloatHeader: 4.5 | |||
| 3.6. Strings | 3.6. 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 0x20 to 0x7E). Note that this excludes tabs, newlines, | the range 0x20 to 0x7E). Note that this excludes tabs, newlines, | |||
| skipping to change at page 11, line 48 ¶ | skipping to change at page 12, line 13 ¶ | |||
| Given a structure defined in this specification: | Given a structure defined in this specification: | |||
| 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 send the serialize field at all | (i.e., it has no members), do not send the serialize field at all | |||
| (i.e., omit both the field-name and field-value). | (i.e., omit both the field-name and field-value). | |||
| 2. If the structure is a dictionary, let output_string be the result | 2. If the structure is a dictionary, let output_string be the result | |||
| of Serializing a Dictionary (Section 4.1.2). | of Serializing a Dictionary (Section 4.1.2). | |||
| 3. Else if the structure is a list, let output_string be the result | 3. Else if the structure is a list, let output_string be the result | |||
| of Serializing a List Section 4.1.1. | of Serializing a List (Section 4.1.1). | |||
| 4. Else if the structure is an item, let output_string be the result | 4. Else if the structure is an item, let output_string be the result | |||
| of Serializing an Item (Section 4.1.3). | of Serializing an Item (Section 4.1.3). | |||
| 5. Else, fail serialisation. | 5. Else, fail serialisation. | |||
| 6. Return output_string converted into an array of bytes, using | 6. Return output_string converted into an array of bytes, using | |||
| ASCII encoding [RFC0020]. | ASCII encoding [RFC0020]. | |||
| 4.1.1. Serializing a List | 4.1.1. Serializing a List | |||
| skipping to change at page 12, line 27 ¶ | skipping to change at page 12, line 40 ¶ | |||
| 1. If member is an array, let mem_value be the result of | 1. If member is an array, let mem_value be the result of | |||
| applying Serialising an Inner List (Section 4.1.1.1) to | applying Serialising an Inner List (Section 4.1.1.1) to | |||
| member. | member. | |||
| 2. Otherwise, let mem_value be the result of applying | 2. Otherwise, let mem_value be the result of applying | |||
| Serializing an Item (Section 4.1.3) to member. | Serializing an Item (Section 4.1.3) to member. | |||
| 3. Append mem_value to output. | 3. Append mem_value to output. | |||
| 4. For each parameter in parameters: | 4. Append the result of Serializing Parameters Section 4.1.1.2 | |||
| with parameters to output. | ||||
| 1. Append ";" to output. | ||||
| 2. Let name be the result of applying Serializing a Key | ||||
| (Section 4.1.1.2) to parameter's param-name. | ||||
| 3. Append name to output. | ||||
| 4. If parameter has a param-value: | ||||
| 1. Let value be the result of applying Serializing an | ||||
| Item (Section 4.1.3) to parameter's param-value. | ||||
| 2. Append "=" to output. | ||||
| 3. Append value to output. | ||||
| 5. If more members remain in input_plist: | 5. If more members remain in input_plist: | |||
| 1. Append a COMMA to output. | 1. Append a COMMA to output. | |||
| 2. Append a single WS to output. | 2. Append a single WS to output. | |||
| 3. Return output. | 3. Return output. | |||
| 4.1.1.1. Serialising an Inner List | 4.1.1.1. Serialising an Inner List | |||
| skipping to change at page 13, line 24 ¶ | skipping to change at page 13, line 24 ¶ | |||
| (Section 4.1.3) to mem. | (Section 4.1.3) to mem. | |||
| 2. Append value to output. | 2. Append value to output. | |||
| 3. If inner_list is not empty, append a single WS to output. | 3. If inner_list is not empty, append a single WS to output. | |||
| 3. Append ")" to output. | 3. Append ")" to output. | |||
| 4. Return output. | 4. Return output. | |||
| 4.1.1.2. Serializing a Key | 4.1.1.2. Serializing Parameters | |||
| Given an ordered dictionary parameters: | ||||
| 1. Let output be an empty string. | ||||
| 2. For each parameter in parameters: | ||||
| 3. Append ";" to output. | ||||
| 4. Let name be the result of applying Serializing a Key | ||||
| (Section 4.1.1.3) to parameter's param-name. | ||||
| 5. Append name to output. | ||||
| 6. If parameter has a param-value: | ||||
| 1. Let value be the result of applying Serializing an Item | ||||
| (Section 4.1.3) to parameter's param-value. | ||||
| 2. Append "=" to output. | ||||
| 3. Append value to output. | ||||
| 7. Return output. | ||||
| 4.1.1.3. Serializing a Key | ||||
| Given a key as input_key: | Given a key as input_key: | |||
| 1. If input_key is not a sequence of characters, or contains | 1. If input_key is not a sequence of characters, or contains | |||
| characters not allowed in the ABNF for key, fail serialisation. | characters not allowed in the ABNF for key, fail serialisation. | |||
| 2. Let output be an empty string. | 2. Let output be an empty string. | |||
| 3. Append input_key to output. | 3. Append input_key to output. | |||
| 4. Return output. | 4. Return output. | |||
| 4.1.2. Serializing a Dictionary | 4.1.2. Serializing a Dictionary | |||
| Given a dictionary as input_dictionary: | Given a dictionary as input_dictionary: | |||
| 1. Let output be an empty string. | 1. Let output be an empty string. | |||
| 2. For each member mem of input_dictionary: | 2. For each (member, parameters) of input_dictionary: | |||
| 1. Let name be the result of applying Serializing a Key | 1. Let name be the result of applying Serializing a Key | |||
| (Section 4.1.1.2) to mem's member-name. | (Section 4.1.1.3) to member's member-name. | |||
| 2. Append name to output. | 2. Append name to output. | |||
| 3. Append "=" to output. | 3. Append "=" to output. | |||
| 4. If mem is an array, let value be the result of applying | 4. If member is an array, let value be the result of applying | |||
| Serialising an Inner List (Section 4.1.1.1) to mem. | Serialising an Inner List (Section 4.1.1.1) to member. | |||
| 5. Otherwise, let value be the result of applying Serializing an | 5. Otherwise, let value be the result of applying Serializing an | |||
| Item (Section 4.1.3) to mem. | Item (Section 4.1.3) to member. | |||
| 6. Append value to output. | 6. Append value to output. | |||
| 7. If more members remain in input_dictionary: | 7. Append the result of Serializing Parameters Section 4.1.1.2 | |||
| with parameters to output. | ||||
| 8. If more members remain in input_dictionary: | ||||
| 1. Append a COMMA to output. | 1. Append a COMMA to output. | |||
| 2. Append a single WS to output. | 2. Append a single WS to output. | |||
| 3. Return output. | 3. Return output. | |||
| 4.1.3. Serializing an Item | 4.1.3. Serializing an Item | |||
| Given an item as input_item: | Given an item as input_item: | |||
| skipping to change at page 15, line 19 ¶ | skipping to change at page 15, line 51 ¶ | |||
| 4. Append input_integer's numeric value represented in base 10 using | 4. Append input_integer's numeric value represented in base 10 using | |||
| only decimal digits to output. | only decimal digits to output. | |||
| 5. Return output. | 5. Return output. | |||
| 4.1.5. Serializing a Float | 4.1.5. Serializing a Float | |||
| Given a float as input_float: | Given a float as input_float: | |||
| 1. If input_float is not a IEEE 754 double precision number, fail | 1. If input_float's fractional component has more than six digits of | |||
| serialisation. | precision, fail serialisation. | |||
| 2. Let output be an empty string. | 2. If the number of digits of precision in input_float's fractional | |||
| component plus those in its integer component add to more than | ||||
| fifteen digits, fail serialisation. | ||||
| 3. If input_float is less than (but not equal to) 0, append "-" to | 3. Let output be an empty string. | |||
| 4. If input_float is less than (but not equal to) 0, append "-" to | ||||
| output. | output. | |||
| 4. Append input_float's integer component represented in base 10 | 5. Append input_float's integer component represented in base 10 | |||
| using only decimal digits to output; if it is zero, append "0". | using only decimal digits to output; if it is zero, append "0". | |||
| 5. Append "." to output. | 6. Append "." to output. | |||
| 6. Append input_float's decimal component represented in base 10 | 7. Append input_float's fractional component represented in base 10 | |||
| using only decimal digits to output; if it is zero, append "0". | using only decimal digits to output; if it is zero, append "0". | |||
| 7. Return output. | 8. Return output. | |||
| 4.1.6. Serializing a String | 4.1.6. Serializing a String | |||
| Given a string as input_string: | Given a string as input_string: | |||
| 1. If input_string is not a sequence of characters, or contains | 1. If input_string is not a sequence of characters, or contains | |||
| characters outside the range allowed by VCHAR or SP, fail | characters outside the range allowed by VCHAR or SP, fail | |||
| serialisation. | serialisation. | |||
| 2. Let output be an empty string. | 2. Let output be an empty string. | |||
| skipping to change at page 16, line 18 ¶ | skipping to change at page 17, line 6 ¶ | |||
| 5. Append DQUOTE to output. | 5. Append DQUOTE to output. | |||
| 6. Return output. | 6. Return output. | |||
| 4.1.7. Serializing a Token | 4.1.7. Serializing a Token | |||
| Given a token as input_token: | Given a token as input_token: | |||
| 1. If input_token is not a sequence of characters, or contains | 1. If input_token is not a sequence of characters, or contains | |||
| characters not allowed in Section 3.7}, fail serialisation. | characters not allowed in Section 3.7, fail serialisation. | |||
| 2. Let output be an empty string. | 2. Let output be an empty string. | |||
| 3. Append input_token to output. | 3. Append input_token to output. | |||
| 4. Return output. | 4. Return output. | |||
| 4.1.8. Serializing a Byte Sequence | 4.1.8. Serializing a Byte Sequence | |||
| Given a byte sequence as input_bytes: | Given a byte sequence as input_bytes: | |||
| skipping to change at page 21, line 8 ¶ | skipping to change at page 21, line 41 ¶ | |||
| 1. Let this_key be the result of running Parsing a Key from | 1. Let this_key be the result of running Parsing a Key from | |||
| Text (Section 4.2.3) with input_string. | Text (Section 4.2.3) with input_string. | |||
| 2. If dictionary already contains the name this_key, there is a | 2. If dictionary already contains the name this_key, there is a | |||
| duplicate; fail parsing. | duplicate; fail parsing. | |||
| 3. Consume the first character of input_string; if it is not | 3. Consume the first character of input_string; if it is not | |||
| "=", fail parsing. | "=", fail parsing. | |||
| 4. If the first character of input_string is "(", let | 4. Let member be the result of running Parsing a Parameterized | |||
| this_value be the result of running Parsing an Inner List | Member from Text (Section 4.2.1.1) with input_string. | |||
| (Section 4.2.1.2) with input_string. | ||||
| 5. Else, let this_value be the result of running Parsing an | ||||
| Item (Section 4.2.4) with input_string. | ||||
| 6. Add name this_key with value this_value to dictionary. | 5. Add name this_key with value member to dictionary. | |||
| 7. Discard any leading OWS from input_string. | 6. Discard any leading OWS from input_string. | |||
| 8. If input_string is empty, return dictionary. | 7. If input_string is empty, return dictionary. | |||
| 9. Consume the first character of input_string; if it is not | 8. Consume the first character of input_string; if it is not | |||
| COMMA, fail parsing. | COMMA, fail parsing. | |||
| 10. Discard any leading OWS from input_string. | 9. Discard any leading OWS from input_string. | |||
| 11. If input_string is empty, there is a trailing comma; fail | 10. If input_string is empty, there is a trailing comma; fail | |||
| parsing. | parsing. | |||
| 3. No structured data has been found; return dictionary (which is | 3. No structured data has been found; return dictionary (which is | |||
| empty). | empty). | |||
| 4.2.3. Parsing a Key from Text | 4.2.3. Parsing a Key from Text | |||
| Given an ASCII string input_string, return a key. input_string is | Given an ASCII string input_string, return a key. input_string is | |||
| modified to remove the parsed value. | modified to remove the parsed value. | |||
| 1. If the first character of input_string is not lcalpha, fail | 1. If the first character of input_string is not lcalpha, fail | |||
| parsing. | parsing. | |||
| 2. Let output_string be an empty string. | 2. Let output_string be an empty string. | |||
| 3. While input_string is not empty: | 3. While input_string is not empty: | |||
| 1. Let char be the result of removing the first character of | 1. Let char be the result of removing the first character of | |||
| input_string. | input_string. | |||
| 2. If char is not one of lcalpha, DIGIT, "_", or "-": | 2. If char is not one of lcalpha, DIGIT, "*", "_", or "-": | |||
| 1. Prepend char to input_string. | 1. Prepend char to input_string. | |||
| 2. Return output_string. | 2. Return output_string. | |||
| 3. Append char to output_string. | 3. Append char to output_string. | |||
| 4. Return output_string. | 4. Return output_string. | |||
| 4.2.4. Parsing an Item from Text | 4.2.4. Parsing an Item from Text | |||
| skipping to change at page 22, line 38 ¶ | skipping to change at page 23, line 18 ¶ | |||
| 5. If the first character of input_string is an ALPHA, process | 5. If the first character of input_string is an ALPHA, process | |||
| input_string as a token (Section 4.2.7) and return the result. | input_string as a token (Section 4.2.7) and return the result. | |||
| 6. Otherwise, the item type is unrecognized; fail parsing. | 6. Otherwise, the item type is unrecognized; fail parsing. | |||
| 4.2.5. Parsing a Number from Text | 4.2.5. Parsing a Number from Text | |||
| Given an ASCII string input_string, return a number. input_string is | Given an ASCII string input_string, return a number. input_string is | |||
| modified to remove the parsed value. | modified to remove the parsed value. | |||
| NOTE: This algorithm parses both Integers Section 3.4 and Floats | NOTE: This algorithm parses both Integers (Section 3.4) and Floats | |||
| Section 3.5, and returns the corresponding structure. | (Section 3.5), and returns the corresponding structure. | |||
| 1. Let type be "integer". | 1. Let type be "integer". | |||
| 2. Let sign be 1. | 2. Let sign be 1. | |||
| 3. Let input_number be an empty string. | 3. Let input_number be an empty string. | |||
| 4. If the first character of input_string is "-", consume it and | 4. If the first character of input_string is "-", consume it and | |||
| set sign to -1. | set sign to -1. | |||
| skipping to change at page 23, line 38 ¶ | skipping to change at page 24, line 17 ¶ | |||
| 1. Parse input_number as an integer and let output_number be | 1. Parse input_number as an integer and let output_number be | |||
| the product of the result and sign. | the product of the result and sign. | |||
| 2. If output_number is outside the range defined in | 2. If output_number is outside the range defined in | |||
| Section 3.4, fail parsing. | Section 3.4, fail parsing. | |||
| 9. Otherwise: | 9. Otherwise: | |||
| 1. If the final character of input_number is ".", fail parsing. | 1. If the final character of input_number is ".", fail parsing. | |||
| 2. Parse input_number as a float and let output_number be the | 2. If the number of characters after "." in input_number is | |||
| greater than six, fail parsing. | ||||
| 3. Parse input_number as a float and let output_number be the | ||||
| product of the result and sign. | product of the result and sign. | |||
| 10. Return output_number. | 10. Return output_number. | |||
| 4.2.6. Parsing a String from Text | 4.2.6. Parsing a String from Text | |||
| Given an ASCII string input_string, return an unquoted string. | Given an ASCII string input_string, return an unquoted string. | |||
| input_string is modified to remove the parsed value. | input_string is modified to remove the parsed value. | |||
| 1. Let output_string be an empty string. | 1. Let output_string be an empty string. | |||
| skipping to change at page 30, line 25 ¶ | skipping to change at page 31, line 9 ¶ | |||
| Likewise, implementations should note that it's important to preserve | Likewise, implementations should note that it's important to preserve | |||
| the distinction between tokens and strings. While most programming | the distinction between tokens and strings. While most programming | |||
| languages have native types that map to the other types well, it may | languages have native types that map to the other types well, it may | |||
| be necessary to create a wrapper "token" object or use a parameter on | be necessary to create a wrapper "token" object or use a parameter on | |||
| functions to assure that these types remain separate. | functions to assure that these types remain separate. | |||
| Appendix D. Changes | Appendix D. Changes | |||
| _RFC Editor: Please remove this section before publication._ | _RFC Editor: Please remove this section before publication._ | |||
| D.1. Since draft-ietf-httpbis-header-structure-10 | D.1. Since draft-ietf-httpbis-header-structure-11 | |||
| o Allow * in key (#844). | ||||
| o Constrain floats to six digits of precision (#848). | ||||
| o Allow dictionary members to have parameters (#842). | ||||
| D.2. Since draft-ietf-httpbis-header-structure-10 | ||||
| o Update abstract (#799). | o Update abstract (#799). | |||
| o Input and output are now arrays of bytes (#662). | o Input and output are now arrays of bytes (#662). | |||
| o Implementations need to preserve difference between token and | o Implementations need to preserve difference between token and | |||
| string (#790). | string (#790). | |||
| o Allow empty dictionaries and lists (#781). | o Allow empty dictionaries and lists (#781). | |||
| o Change parameterized lists to have primary items (#797). | o Change parameterized lists to have primary items (#797). | |||
| o Allow inner lists in both dictionaries and lists; removes lists of | o Allow inner lists in both dictionaries and lists; removes lists of | |||
| lists (#816). | lists (#816). | |||
| o Subsume Parameterised Lists into Lists (#839). | o Subsume Parameterised Lists into Lists (#839). | |||
| D.2. Since draft-ietf-httpbis-header-structure-09 | D.3. Since draft-ietf-httpbis-header-structure-09 | |||
| o Changed Boolean from T/F to 1/0 (#784). | o Changed Boolean from T/F to 1/0 (#784). | |||
| o Parameters are now ordered maps (#765). | o Parameters are now ordered maps (#765). | |||
| o Clamp integers to 15 digits (#737). | o Clamp integers to 15 digits (#737). | |||
| D.3. Since draft-ietf-httpbis-header-structure-08 | D.4. Since draft-ietf-httpbis-header-structure-08 | |||
| o Disallow whitespace before items properly (#703). | o Disallow whitespace before items properly (#703). | |||
| o Created "key" for use in dictionaries and parameters, rather than | o Created "key" for use in dictionaries and parameters, rather than | |||
| relying on identifier (#702). Identifiers have a separate minimum | relying on identifier (#702). Identifiers have a separate minimum | |||
| supported size. | supported size. | |||
| o Expanded the range of special characters allowed in identifier to | o Expanded the range of special characters allowed in identifier to | |||
| include all of ALPHA, ".", ":", and "%" (#702). | include all of ALPHA, ".", ":", and "%" (#702). | |||
| skipping to change at page 31, line 29 ¶ | skipping to change at page 32, line 18 ¶ | |||
| o Gave better names for referring specs to use in Parameterised | o Gave better names for referring specs to use in Parameterised | |||
| Lists (#720). | Lists (#720). | |||
| o Added Lists of Lists (#721). | o Added Lists of Lists (#721). | |||
| o Rename Identifier to Token (#725). | o Rename Identifier to Token (#725). | |||
| o Add implementation guidance (#727). | o Add implementation guidance (#727). | |||
| D.4. Since draft-ietf-httpbis-header-structure-07 | D.5. Since draft-ietf-httpbis-header-structure-07 | |||
| o Make Dictionaries ordered mappings (#659). | o Make Dictionaries ordered mappings (#659). | |||
| o Changed "binary content" to "byte sequence" to align with Infra | o Changed "binary content" to "byte sequence" to align with Infra | |||
| specification (#671). | specification (#671). | |||
| o Changed "mapping" to "map" for #671. | o Changed "mapping" to "map" for #671. | |||
| o Don't fail if byte sequences aren't "=" padded (#658). | o Don't fail if byte sequences aren't "=" padded (#658). | |||
| o Add Booleans (#683). | o Add Booleans (#683). | |||
| o Allow identifiers in items again (#629). | o Allow identifiers in items again (#629). | |||
| o Disallowed whitespace before items (#703). | o Disallowed whitespace before items (#703). | |||
| o Explain the consequences of splitting a string across multiple | o Explain the consequences of splitting a string across multiple | |||
| headers (#686). | headers (#686). | |||
| D.5. Since draft-ietf-httpbis-header-structure-06 | D.6. Since draft-ietf-httpbis-header-structure-06 | |||
| o Add a FAQ. | o Add a FAQ. | |||
| o Allow non-zero pad bits. | o Allow non-zero pad bits. | |||
| o Explicitly check for integers that violate constraints. | o Explicitly check for integers that violate constraints. | |||
| D.6. Since draft-ietf-httpbis-header-structure-05 | D.7. Since draft-ietf-httpbis-header-structure-05 | |||
| o Reorganise specification to separate parsing out. | o Reorganise specification to separate parsing out. | |||
| o Allow referencing specs to use ABNF. | o Allow referencing specs to use ABNF. | |||
| o Define serialisation algorithms. | o Define serialisation algorithms. | |||
| o Refine relationship between ABNF, parsing and serialisation | o Refine relationship between ABNF, parsing and serialisation | |||
| algorithms. | algorithms. | |||
| D.7. Since draft-ietf-httpbis-header-structure-04 | D.8. Since draft-ietf-httpbis-header-structure-04 | |||
| o Remove identifiers from item. | o Remove identifiers from item. | |||
| o Remove most limits on sizes. | o Remove most limits on sizes. | |||
| o Refine number parsing. | o Refine number parsing. | |||
| D.8. Since draft-ietf-httpbis-header-structure-03 | D.9. Since draft-ietf-httpbis-header-structure-03 | |||
| o Strengthen language around failure handling. | o Strengthen language around failure handling. | |||
| D.9. Since draft-ietf-httpbis-header-structure-02 | D.10. Since draft-ietf-httpbis-header-structure-02 | |||
| o Split Numbers into Integers and Floats. | o Split Numbers into Integers and Floats. | |||
| o Define number parsing. | o Define number parsing. | |||
| o Tighten up binary parsing and give it an explicit end delimiter. | o Tighten up binary parsing and give it an explicit end delimiter. | |||
| o Clarify that mappings are unordered. | o Clarify that mappings are unordered. | |||
| o Allow zero-length strings. | o Allow zero-length strings. | |||
| o Improve string parsing algorithm. | o Improve string parsing algorithm. | |||
| o Improve limits in algorithms. | o Improve limits in algorithms. | |||
| o Require parsers to combine header fields before processing. | o Require parsers to combine header fields before processing. | |||
| o Throw an error on trailing garbage. | o Throw an error on trailing garbage. | |||
| D.10. Since draft-ietf-httpbis-header-structure-01 | D.11. Since draft-ietf-httpbis-header-structure-01 | |||
| o Replaced with draft-nottingham-structured-headers. | o Replaced with draft-nottingham-structured-headers. | |||
| D.11. Since draft-ietf-httpbis-header-structure-00 | D.12. Since draft-ietf-httpbis-header-structure-00 | |||
| o Added signed 64bit integer type. | o Added signed 64bit integer type. | |||
| o Drop UTF8, and settle on BCP137 ::EmbeddedUnicodeChar for h1- | o Drop UTF8, and settle on BCP137 ::EmbeddedUnicodeChar for h1- | |||
| unicode-string. | unicode-string. | |||
| o Change h1_blob delimiter to ":" since "'" is valid t_char | o Change h1_blob delimiter to ":" since "'" is valid t_char | |||
| Authors' Addresses | Authors' Addresses | |||
| End of changes. 52 change blocks. | ||||
| 115 lines changed or deleted | 152 lines changed or added | |||
This html diff was produced by rfcdiff 1.45. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ | ||||