| draft-reschke-http-jfv-05.txt | draft-reschke-http-jfv-06.txt | |||
|---|---|---|---|---|
| Network Working Group J. Reschke | Network Working Group J. Reschke | |||
| Internet-Draft greenbytes | Internet-Draft greenbytes | |||
| Intended status: Standards Track December 16, 2016 | Intended status: Standards Track June 25, 2017 | |||
| Expires: June 19, 2017 | Expires: December 27, 2017 | |||
| A JSON Encoding for HTTP Header Field Values | A JSON Encoding for HTTP Header Field Values | |||
| draft-reschke-http-jfv-05 | draft-reschke-http-jfv-06 | |||
| Abstract | Abstract | |||
| This document establishes a convention for use of JSON-encoded field | This document establishes a convention for use of JSON-encoded field | |||
| values in HTTP header fields. | values in HTTP header fields. | |||
| Editorial Note (To be removed by RFC Editor before publication) | Editorial Note (To be removed by RFC Editor before publication) | |||
| Distribution of this document is unlimited. Although this is not a | Distribution of this document is unlimited. Although this is not a | |||
| work item of the HTTPbis Working Group, comments should be sent to | work item of the HTTPbis Working Group, comments should be sent to | |||
| the Hypertext Transfer Protocol (HTTP) mailing list at | the Hypertext Transfer Protocol (HTTP) mailing list at ietf-http- | |||
| ietf-http-wg@w3.org [1], which may be joined by sending a message | wg@w3.org [1], which may be joined by sending a message with subject | |||
| with subject "subscribe" to ietf-http-wg-request@w3.org [2]. | "subscribe" to ietf-http-wg-request@w3.org [2]. | |||
| Discussions of the HTTPbis Working Group are archived at | Discussions of the HTTPbis Working Group are archived at | |||
| <http://lists.w3.org/Archives/Public/ietf-http-wg/>. | <http://lists.w3.org/Archives/Public/ietf-http-wg/>. | |||
| XML versions and latest edits for this document are available from | XML versions and latest edits for this document are available from | |||
| <http://greenbytes.de/tech/webdav/#draft-reschke-http-jfv>. | <http://greenbytes.de/tech/webdav/#draft-reschke-http-jfv>. | |||
| The changes in this draft are summarized in Appendix C.5. | The changes in this draft are summarized in Appendix E.9. | |||
| Status of This Memo | Status of This Memo | |||
| This Internet-Draft is submitted in full conformance with the | This Internet-Draft is submitted in full conformance with the | |||
| provisions of BCP 78 and BCP 79. | provisions of BCP 78 and BCP 79. | |||
| 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 http://datatracker.ietf.org/drafts/current/. | Drafts is at http://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 June 19, 2017. | This Internet-Draft will expire on December 27, 2017. | |||
| Copyright Notice | Copyright Notice | |||
| Copyright (c) 2016 IETF Trust and the persons identified as the | ||||
| Copyright (c) 2017 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 | |||
| (http://trustee.ietf.org/license-info) in effect on the date of | (http://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 | |||
| carefully, as they describe your rights and restrictions with respect | carefully, as they describe your rights and restrictions with respect | |||
| to this document. Code Components extracted from this document must | to this document. Code Components extracted from this document must | |||
| include Simplified BSD License text as described in Section 4.e of | include Simplified BSD License text as described in Section 4.e of | |||
| 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 | |||
| 2. Data Model and Format . . . . . . . . . . . . . . . . . . . . 3 | 2. Data Model and Format . . . . . . . . . . . . . . . . . . . . 4 | |||
| 3. Sender Requirements . . . . . . . . . . . . . . . . . . . . . 4 | 3. Sender Requirements . . . . . . . . . . . . . . . . . . . . . 5 | |||
| 4. Recipient Requirements . . . . . . . . . . . . . . . . . . . . 5 | 4. Recipient Requirements . . . . . . . . . . . . . . . . . . . 5 | |||
| 5. Using this Format in Header Field Definitions . . . . . . . . 5 | 5. Using this Format in Header Field Definitions . . . . . . . . 5 | |||
| 6. Deployment Considerations . . . . . . . . . . . . . . . . . . 5 | 6. Deployment Considerations . . . . . . . . . . . . . . . . . . 6 | |||
| 7. Interoperability Considerations . . . . . . . . . . . . . . . 5 | 7. Interoperability Considerations . . . . . . . . . . . . . . . 6 | |||
| 7.1. Encoding and Characters . . . . . . . . . . . . . . . . . 5 | 7.1. Encoding and Characters . . . . . . . . . . . . . . . . . 6 | |||
| 7.2. Numbers . . . . . . . . . . . . . . . . . . . . . . . . . 6 | 7.2. Numbers . . . . . . . . . . . . . . . . . . . . . . . . . 6 | |||
| 7.3. Object Constraints . . . . . . . . . . . . . . . . . . . . 6 | 7.3. Object Constraints . . . . . . . . . . . . . . . . . . . 7 | |||
| 8. Internationalization Considerations . . . . . . . . . . . . . 6 | 8. Internationalization Considerations . . . . . . . . . . . . . 7 | |||
| 9. Security Considerations . . . . . . . . . . . . . . . . . . . 6 | 9. Security Considerations . . . . . . . . . . . . . . . . . . . 7 | |||
| 10. References . . . . . . . . . . . . . . . . . . . . . . . . . . 7 | 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 7 | |||
| 10.1. Normative References . . . . . . . . . . . . . . . . . . . 7 | 10.1. Normative References . . . . . . . . . . . . . . . . . . 7 | |||
| 10.2. Informative References . . . . . . . . . . . . . . . . . . 7 | 10.2. Informative References . . . . . . . . . . . . . . . . . 8 | |||
| Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 8 | Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 10 | |||
| A.1. Content-Length . . . . . . . . . . . . . . . . . . . . . . 8 | A.1. Content-Length . . . . . . . . . . . . . . . . . . . . . 10 | |||
| A.2. Content-Disposition . . . . . . . . . . . . . . . . . . . 9 | A.2. Content-Disposition . . . . . . . . . . . . . . . . . . . 10 | |||
| A.3. WWW-Authenticate . . . . . . . . . . . . . . . . . . . . . 10 | A.3. WWW-Authenticate . . . . . . . . . . . . . . . . . . . . 11 | |||
| A.4. Accept-Encoding . . . . . . . . . . . . . . . . . . . . . 11 | A.4. Accept-Encoding . . . . . . . . . . . . . . . . . . . . . 12 | |||
| Appendix B. Discussion . . . . . . . . . . . . . . . . . . . . . 12 | Appendix B. Use of JSON Field Value Encoding in the Wild . . . . 13 | |||
| Appendix C. Change Log (to be removed by RFC Editor before | B.1. W3C Reporting API Specification . . . . . . . . . . . . . 14 | |||
| publication) . . . . . . . . . . . . . . . . . . . . 12 | B.2. W3C Clear Site Data Specification . . . . . . . . . . . . 14 | |||
| C.1. Since draft-reschke-http-jfv-00 . . . . . . . . . . . . . 12 | B.3. W3C Feature Policy Specification . . . . . . . . . . . . 14 | |||
| C.2. Since draft-reschke-http-jfv-01 . . . . . . . . . . . . . 12 | Appendix C. Relation to HTTP 'Key' Header Field . . . . . . . . 14 | |||
| C.3. Since draft-reschke-http-jfv-02 . . . . . . . . . . . . . 13 | Appendix D. Discussion . . . . . . . . . . . . . . . . . . . . . 14 | |||
| C.4. Since draft-reschke-http-jfv-03 . . . . . . . . . . . . . 13 | Appendix E. Change Log (to be removed by RFC Editor before | |||
| C.5. Since draft-reschke-http-jfv-04 . . . . . . . . . . . . . 13 | publication) . . . . . . . . . . . . . . . . . . . . 14 | |||
| C.5.1. Since draft-ietf-httpbis-jfv-00 . . . . . . . . . . . 13 | E.1. Since draft-reschke-http-jfv-00 . . . . . . . . . . . . . 15 | |||
| C.5.2. Since draft-ietf-httpbis-jfv-01 . . . . . . . . . . . 13 | E.2. Since draft-reschke-http-jfv-01 . . . . . . . . . . . . . 15 | |||
| C.5.3. Since draft-ietf-httpbis-jfv-02 . . . . . . . . . . . 13 | E.3. Since draft-reschke-http-jfv-02 . . . . . . . . . . . . . 15 | |||
| Appendix D. Acknowledgements . . . . . . . . . . . . . . . . . . 13 | E.4. Since draft-reschke-http-jfv-03 . . . . . . . . . . . . . 15 | |||
| E.5. Since draft-reschke-http-jfv-04 . . . . . . . . . . . . . 15 | ||||
| E.6. Since draft-ietf-httpbis-jfv-00 . . . . . . . . . . . . . 15 | ||||
| E.7. Since draft-ietf-httpbis-jfv-01 . . . . . . . . . . . . . 15 | ||||
| E.8. Since draft-ietf-httpbis-jfv-02 . . . . . . . . . . . . . 15 | ||||
| E.9. Since draft-reschke-http-jfv-05 . . . . . . . . . . . . . 16 | ||||
| Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 16 | ||||
| Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 16 | ||||
| 1. Introduction | 1. Introduction | |||
| Defining syntax for new HTTP header fields ([RFC7230], Section 3.2) | Defining syntax for new HTTP header fields ([RFC7230], Section 3.2) | |||
| is non-trivial. Among the commonly encountered problems are: | is non-trivial. Among the commonly encountered problems are: | |||
| o There is no common syntax for complex field values. Several well- | o There is no common syntax for complex field values. Several well- | |||
| known header fields do use a similarly looking syntax, but it is | known header fields do use a similarly looking syntax, but it is | |||
| hard to write generic parsing code that will both correctly handle | hard to write generic parsing code that will both correctly handle | |||
| valid field values but also reject invalid ones. | valid field values but also reject invalid ones. | |||
| skipping to change at page 3, line 43 ¶ | skipping to change at page 4, line 5 ¶ | |||
| format that can be used in definitions of new header fields, where | format that can be used in definitions of new header fields, where | |||
| the goals were: | the goals were: | |||
| o to be compatible with header field recombination when fields occur | o to be compatible with header field recombination when fields occur | |||
| multiple times in a single message (Section 3.2.2 of [RFC7230]), | multiple times in a single message (Section 3.2.2 of [RFC7230]), | |||
| and | and | |||
| o not to use any problematic characters in the field value (non- | o not to use any problematic characters in the field value (non- | |||
| ASCII characters and certain whitespace characters). | ASCII characters and certain whitespace characters). | |||
| Note: [HSTRUCT], a work item of the IETF HTTP Working Group, is a | ||||
| different attempt to address this set of problems -- it tries to | ||||
| identify and formalize common field structures in existing header | ||||
| fields; the syntax defined over there would usually lead to a more | ||||
| compact notation. | ||||
| 2. Data Model and Format | 2. Data Model and Format | |||
| In HTTP, header fields with the same field name can occur multiple | In HTTP, header fields with the same field name can occur multiple | |||
| times within a single message (Section 3.2.2 of [RFC7230]). When | times within a single message (Section 3.2.2 of [RFC7230]). When | |||
| this happens, recipients are allowed to combine the field values | this happens, recipients are allowed to combine the field values | |||
| using commas as delimiter. This rule matches nicely JSON's array | using commas as delimiter. This rule matches nicely JSON's array | |||
| format (Section 5 of [RFC7159]). Thus, the basic data model used | format (Section 5 of [RFC7159]). Thus, the basic data model used | |||
| here is the JSON array. | here is the JSON array. | |||
| Header field definitions that need only a single value can restrict | Header field definitions that need only a single value can restrict | |||
| skipping to change at page 5, line 31 ¶ | skipping to change at page 5, line 47 ¶ | |||
| ("]") octet, then | ("]") octet, then | |||
| 3. run the resulting octet sequence through a JSON parser. | 3. run the resulting octet sequence through a JSON parser. | |||
| The result of the parsing operation is either an error (in which case | The result of the parsing operation is either an error (in which case | |||
| the header field values needs to be considered invalid), or a JSON | the header field values needs to be considered invalid), or a JSON | |||
| array. | array. | |||
| 5. Using this Format in Header Field Definitions | 5. Using this Format in Header Field Definitions | |||
| [[anchor5: Explain what a definition of a new header field needs to | Specifications defining new HTTP header fields need to take the | |||
| do precisely to use this format, mention must-ignore extensibility]] | considerations listed in Section 8.3.1 of [RFC7231] into account. | |||
| Many of these will already be accounted for by using the format | ||||
| defined in this specification. | ||||
| Readers of HTTP-related specifications frequently expect an ABNF | ||||
| definition of the field value syntax. This is not really needed | ||||
| here, as the actual syntax is JSON text, as defined in Section 2 of | ||||
| [RFC7159]. | ||||
| A very simple way to use this JSON encoding thus is just to cite this | ||||
| specification -- specifically the "json-field-value" ABNF production | ||||
| defined in Section 2 -- and otherwise not to talk about the details | ||||
| of the field syntax at all. | ||||
| An alternative approach is just to repeat the ABNF-related parts from | ||||
| Section 2. | ||||
| This frees the specification from defining the concrete on-the-wire | ||||
| syntax. What's left is defining the field value in terms of a JSON | ||||
| array. An important aspect is the question of extensibility, e.g. | ||||
| how recipients ought to treat unknown field names. In general, a | ||||
| "must ignore" approach will allow protocols to evolve without | ||||
| versioning or even using entire new field names. | ||||
| 6. Deployment Considerations | 6. Deployment Considerations | |||
| This JSON-based syntax will only apply to newly introduced header | This JSON-based syntax will only apply to newly introduced header | |||
| fields, thus backwards compatibility is not a problem. That being | fields, thus backwards compatibility is not a problem. That being | |||
| said, it is conceivable that there is existing code that might trip | said, it is conceivable that there is existing code that might trip | |||
| over double quotes not being used for HTTP's quoted-string syntax | over double quotes not being used for HTTP's quoted-string syntax | |||
| (Section 3.2.6 of [RFC7230]). | (Section 3.2.6 of [RFC7230]). | |||
| 7. Interoperability Considerations | 7. Interoperability Considerations | |||
| skipping to change at page 6, line 27 ¶ | skipping to change at page 7, line 22 ¶ | |||
| with [ECMA-262], Section 24.3.1.1). | with [ECMA-262], Section 24.3.1.1). | |||
| Furthermore, ordering of object members is not significant and can | Furthermore, ordering of object members is not significant and can | |||
| not be relied upon. | not be relied upon. | |||
| 8. Internationalization Considerations | 8. Internationalization Considerations | |||
| In HTTP/1.1, header field values are represented by octet sequences, | In HTTP/1.1, header field values are represented by octet sequences, | |||
| usually used to transmit ASCII characters, with restrictions on the | usually used to transmit ASCII characters, with restrictions on the | |||
| use of certain control characters, and no associated default | use of certain control characters, and no associated default | |||
| character encoding, nor a way to describe it ([RFC7230], Section | character encoding, nor a way to describe it ([RFC7230], | |||
| 3.2). HTTP/2 does not change this. | Section 3.2). HTTP/2 does not change this. | |||
| This specification maps all characters which can cause problems to | This specification maps all characters which can cause problems to | |||
| JSON escape sequences, thereby solving the HTTP header field | JSON escape sequences, thereby solving the HTTP header field | |||
| internationalization problem. | internationalization problem. | |||
| Future specifications of HTTP might change to allow non-ASCII | Future specifications of HTTP might change to allow non-ASCII | |||
| characters natively. In that case, header fields using the syntax | characters natively. In that case, header fields using the syntax | |||
| defined by this specification would have a simple migration path (by | defined by this specification would have a simple migration path (by | |||
| just stopping to require escaping of non-ASCII characters). | just stopping to require escaping of non-ASCII characters). | |||
| skipping to change at page 7, line 4 ¶ | skipping to change at page 7, line 46 ¶ | |||
| Using JSON-shaped field values is believed to not introduce any new | Using JSON-shaped field values is believed to not introduce any new | |||
| threads beyond those described in Section 12 of [RFC7159], namely the | threads beyond those described in Section 12 of [RFC7159], namely the | |||
| risk of recipients using the wrong tools to parse them. | risk of recipients using the wrong tools to parse them. | |||
| Other than that, any syntax that makes extensions easy can be used to | Other than that, any syntax that makes extensions easy can be used to | |||
| smuggle information through field values; however, this concern is | smuggle information through field values; however, this concern is | |||
| shared with other widely used formats, such as those using parameters | shared with other widely used formats, such as those using parameters | |||
| in the form of name/value pairs. | in the form of name/value pairs. | |||
| 10. References | 10. References | |||
| 10.1. Normative References | 10.1. Normative References | |||
| [RFC0020] Cerf, V., "ASCII format for network interchange", | [RFC0020] Cerf, V., "ASCII format for network interchange", STD 80, | |||
| STD 80, RFC 20, DOI 10.17487/RFC0020, October 1969, | RFC 20, DOI 10.17487/RFC0020, October 1969, | |||
| <http://www.rfc-editor.org/info/rfc20>. | <http://www.rfc-editor.org/info/rfc20>. | |||
| [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for | [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax | |||
| Syntax Specifications: ABNF", STD 68, RFC 5234, | Specifications: ABNF", STD 68, RFC 5234, | |||
| DOI 10.17487/RFC5234, January 2008, | DOI 10.17487/RFC5234, January 2008, | |||
| <http://www.rfc-editor.org/info/rfc5234>. | <http://www.rfc-editor.org/info/rfc5234>. | |||
| [RFC7159] Bray, T., "The JavaScript Object Notation (JSON) | [RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data | |||
| Data Interchange Format", RFC 7159, DOI 10.17487/ | Interchange Format", RFC 7159, DOI 10.17487/RFC7159, March | |||
| RFC7159, March 2014, | 2014, <http://www.rfc-editor.org/info/rfc7159>. | |||
| <http://www.rfc-editor.org/info/rfc7159>. | ||||
| [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext | [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer | |||
| Transfer Protocol (HTTP/1.1): Message Syntax and | Protocol (HTTP/1.1): Message Syntax and Routing", | |||
| Routing", RFC 7230, DOI 10.17487/RFC7230, | RFC 7230, DOI 10.17487/RFC7230, June 2014, | |||
| June 2014, | <http://www.rfc-editor.org/info/rfc7230>. | |||
| <http://www.rfc-editor.org/info/rfc7230>. | ||||
| [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext | [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer | |||
| Transfer Protocol (HTTP/1.1): Semantics and | Protocol (HTTP/1.1): Semantics and Content", RFC 7231, | |||
| Content", RFC 7231, DOI 10.17487/RFC7231, | DOI 10.17487/RFC7231, June 2014, | |||
| June 2014, | <http://www.rfc-editor.org/info/rfc7231>. | |||
| <http://www.rfc-editor.org/info/rfc7231>. | ||||
| [RFC7493] Bray, T., Ed., "The I-JSON Message Format", | [RFC7493] Bray, T., Ed., "The I-JSON Message Format", RFC 7493, | |||
| RFC 7493, DOI 10.17487/RFC7493, March 2015, | DOI 10.17487/RFC7493, March 2015, | |||
| <http://www.rfc-editor.org/info/rfc7493>. | <http://www.rfc-editor.org/info/rfc7493>. | |||
| 10.2. Informative References | 10.2. Informative References | |||
| [ECMA-262] Ecma International, "ECMA-262 6th Edition, The | [CLEARSITE] | |||
| ECMAScript 2015 Language Specification", | West, M., "Clear Site Data", W3C Working Draft WD-clear- | |||
| Standard ECMA-262, June 2015, | site-data-20160720, July 2016, | |||
| <http://www.ecma-international.org/ecma-262/6.0/>. | <http://www.w3.org/TR/2016/WD-clear-site-data-20160720/>. | |||
| [ISO-8859-1] International Organization for Standardization, | Latest version available at <http://www.w3.org/TR/clear- | |||
| "Information technology -- 8-bit single-byte coded | site-data/>. | |||
| graphic character sets -- Part 1: Latin alphabet | ||||
| No. 1", ISO/IEC 8859-1:1998, 1998. | ||||
| [KEY] Fielding, R. and M. Nottingham, "The Key HTTP | [ECMA-262] | |||
| Response Header Field", draft-ietf-httpbis-key-01 | Ecma International, "ECMA-262 6th Edition, The ECMAScript | |||
| (work in progress), March 2016. | 2015 Language Specification", Standard ECMA-262, June | |||
| 2015, <http://www.ecma-international.org/ecma-262/6.0/>. | ||||
| [RFC5987] Reschke, J., "Character Set and Language Encoding | [FEATUREPOL] | |||
| for Hypertext Transfer Protocol (HTTP) Header Field | Clelland, I., "Clear Site Data", W3C Draft Community Group | |||
| Parameters", RFC 5987, DOI 10.17487/RFC5987, | Report , June 2017, <https://wicg.github.io/feature- | |||
| August 2010, | policy/>. | |||
| <http://www.rfc-editor.org/info/rfc5987>. | ||||
| [RFC6266] Reschke, J., "Use of the Content-Disposition Header | [HSTRUCT] Kamp, P-H., "HTTP Header Common Structure", draft-ietf- | |||
| Field in the Hypertext Transfer Protocol (HTTP)", | httpbis-header-structure-01 (work in progress), April | |||
| RFC 6266, DOI 10.17487/RFC6266, June 2011, | 2017. | |||
| <http://www.rfc-editor.org/info/rfc6266>. | ||||
| [RFC6365] Hoffman, P. and J. Klensin, "Terminology Used in | [ISO-8859-1] | |||
| Internationalization in the IETF", BCP 166, | International Organization for Standardization, | |||
| RFC 6365, DOI 10.17487/RFC6365, September 2011, | "Information technology -- 8-bit single-byte coded graphic | |||
| <http://www.rfc-editor.org/info/rfc6365>. | character sets -- Part 1: Latin alphabet No. 1", ISO/ | |||
| IEC 8859-1:1998, 1998. | ||||
| [RFC7235] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext | [KEY] Fielding, R. and M. Nottingham, "The Key HTTP Response | |||
| Transfer Protocol (HTTP/1.1): Authentication", | Header Field", draft-ietf-httpbis-key-01 (work in | |||
| RFC 7235, DOI 10.17487/RFC7235, June 2014, | progress), March 2016. | |||
| <http://www.rfc-editor.org/info/rfc7235>. | ||||
| [XMLHttpRequest] WhatWG, "XMLHttpRequest", | [REPORTING] | |||
| <https://xhr.spec.whatwg.org/>. | Grigorik, I. and M. West, "Reporting API 1", W3C Group | |||
| Note NOTE-reporting-1-20160607, June 2016, | ||||
| <http://www.w3.org/TR/2016/NOTE-reporting-1-20160607/>. | ||||
| URIs | Latest version available at <http://www.w3.org/TR/ | |||
| reporting-1/>. | ||||
| [1] <mailto:ietf-http-wg@w3.org> | [RFC5987] Reschke, J., "Character Set and Language Encoding for | |||
| Hypertext Transfer Protocol (HTTP) Header Field | ||||
| Parameters", RFC 5987, DOI 10.17487/RFC5987, August 2010, | ||||
| <http://www.rfc-editor.org/info/rfc5987>. | ||||
| [2] <mailto:ietf-http-wg-request@w3.org?subject=subscribe> | [RFC6266] Reschke, J., "Use of the Content-Disposition Header Field | |||
| in the Hypertext Transfer Protocol (HTTP)", RFC 6266, | ||||
| DOI 10.17487/RFC6266, June 2011, | ||||
| <http://www.rfc-editor.org/info/rfc6266>. | ||||
| [RFC6365] Hoffman, P. and J. Klensin, "Terminology Used in | ||||
| Internationalization in the IETF", BCP 166, RFC 6365, | ||||
| DOI 10.17487/RFC6365, September 2011, | ||||
| <http://www.rfc-editor.org/info/rfc6365>. | ||||
| [RFC7235] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer | ||||
| Protocol (HTTP/1.1): Authentication", RFC 7235, | ||||
| DOI 10.17487/RFC7235, June 2014, | ||||
| <http://www.rfc-editor.org/info/rfc7235>. | ||||
| [XMLHttpRequest] | ||||
| WhatWG, "XMLHttpRequest", <https://xhr.spec.whatwg.org/>. | ||||
| Appendix A. Examples | Appendix A. Examples | |||
| This section shows how some of the existing HTTP header fields would | This section shows how some of the existing HTTP header fields would | |||
| look like if they would use the format defined by this specification. | look like if they would use the format defined by this specification. | |||
| A.1. Content-Length | A.1. Content-Length | |||
| "Content-Length" is defined in Section 3.3.2 of [RFC7230], with the | "Content-Length" is defined in Section 3.3.2 of [RFC7230], with the | |||
| field value's ABNF being: | field value's ABNF being: | |||
| Content-Length = 1*DIGIT | Content-Length = 1*DIGIT | |||
| So the field value is similar to a JSON number ([RFC7159], Section | So the field value is similar to a JSON number ([RFC7159], | |||
| 6). | Section 6). | |||
| Content-Length is restricted to a single field instance, as it | Content-Length is restricted to a single field instance, as it | |||
| doesn't use the list production (as per Section 3.2.2 of [RFC7230]). | doesn't use the list production (as per Section 3.2.2 of [RFC7230]). | |||
| However, in practice multiple instances do occur, and the definition | However, in practice multiple instances do occur, and the definition | |||
| of the header field does indeed discuss how to handle these cases. | of the header field does indeed discuss how to handle these cases. | |||
| If Content-Length was defined using the JSON format discussed here, | If Content-Length was defined using the JSON format discussed here, | |||
| the ABNF would be something like: | the ABNF would be something like: | |||
| Content-Length = #number | Content-Length = #number | |||
| skipping to change at page 11, line 26 ¶ | skipping to change at page 12, line 43 ¶ | |||
| codings = content-coding / "identity" / "*" | codings = content-coding / "identity" / "*" | |||
| weight = OWS ";" OWS "q=" qvalue | weight = OWS ";" OWS "q=" qvalue | |||
| qvalue = ( "0" [ "." 0*3DIGIT ] ) | qvalue = ( "0" [ "." 0*3DIGIT ] ) | |||
| / ( "1" [ "." 0*3("0") ] ) | / ( "1" [ "." 0*3("0") ] ) | |||
| An example for a complex header field value given in the definition | An example for a complex header field value given in the definition | |||
| of the header field is: | of the header field is: | |||
| gzip;q=1.0, identity; q=0.5, *;q=0 | gzip;q=1.0, identity; q=0.5, *;q=0 | |||
| Due to the defaulting rules for the quality value ([RFC7231], Section | Due to the defaulting rules for the quality value ([RFC7231], | |||
| 5.3.1), this could also be written as: | Section 5.3.1), this could also be written as: | |||
| gzip, identity; q=0.5, *; q=0 | gzip, identity; q=0.5, *; q=0 | |||
| A JSON representation could be: | A JSON representation could be: | |||
| [ | [ | |||
| { | { | |||
| "gzip" : { | "gzip" : { | |||
| } | } | |||
| }, | }, | |||
| skipping to change at page 12, line 23 ¶ | skipping to change at page 13, line 44 ¶ | |||
| would be mapped to a member whose name is given by the string | would be mapped to a member whose name is given by the string | |||
| literal, and the value is an empty object. | literal, and the value is an empty object. | |||
| For what it's worth, one of the most common cases for 'Accept- | For what it's worth, one of the most common cases for 'Accept- | |||
| Encoding' would become: | Encoding' would become: | |||
| "gzip", "deflate" | "gzip", "deflate" | |||
| which would be only a small overhead over the original format. | which would be only a small overhead over the original format. | |||
| Appendix B. Discussion | Appendix B. Use of JSON Field Value Encoding in the Wild | |||
| Since work started on this document, various specifications have | ||||
| adopted this format. At least one of these moved away after the HTTP | ||||
| Working Group decided to focus on [HSTRUCT] (see thread starting at | ||||
| <https://lists.w3.org/Archives/Public/ietf-http- | ||||
| wg/2016OctDec/0505.html>). | ||||
| The sections below summarize the current usage of this format. | ||||
| B.1. W3C Reporting API Specification | ||||
| Defined in W3C Note "Reporting API 1" (Section 3.1 of [REPORTING]). | ||||
| Still in use in latest editor copy as of June 2017. | ||||
| B.2. W3C Clear Site Data Specification | ||||
| Defined in W3C Working Draft "Clear Site Data" (Section 2.1 of | ||||
| [CLEARSITE]). Latest Editor's Draft replaces the use of JSON with a | ||||
| custom syntax (see <https://lists.w3.org/Archives/Public/ietf-http- | ||||
| wg/2017AprJun/0214.html> for feedback). | ||||
| B.3. W3C Feature Policy Specification | ||||
| Defined in W3C Draft Community Group Report "Feature Policy" | ||||
| (Section 6.1 of [FEATUREPOL]). Previously relied on this document, | ||||
| now replicates the syntax into a custom ABNF defined in a separate | ||||
| section (Section 5.1 of [FEATUREPOL]). | ||||
| Appendix C. Relation to HTTP 'Key' Header Field | ||||
| [KEY] aims to improve the cacheability of responses that vary based | ||||
| on certain request header fields, addressing lack of granularity in | ||||
| the existing "Vary" response header field ([RFC7231], Section 7.1.4). | ||||
| If the JSON-based format described by this document gains popularity, | ||||
| it might be useful to add a JSON-aware "Key Parameter" (see | ||||
| Section 2.3 of [KEY]). | ||||
| Appendix D. Discussion | ||||
| This approach uses a default of "JSON array", using implicit array | This approach uses a default of "JSON array", using implicit array | |||
| markers. An alternative would be a default of "JSON object". This | markers. An alternative would be a default of "JSON object". This | |||
| would simplify the syntax for non-list-typed header fields, but all | would simplify the syntax for non-list-typed header fields, but all | |||
| the benefits of having the same data model for both types of header | the benefits of having the same data model for both types of header | |||
| fields would be gone. A hybrid approach might make sense, as long as | fields would be gone. A hybrid approach might make sense, as long as | |||
| it doesn't require any heuristics on the recipient's side. | it doesn't require any heuristics on the recipient's side. | |||
| Note: a concrete proposal was made by Kazuho Oku in <https:// | Note: a concrete proposal was made by Kazuho Oku in | |||
| lists.w3.org/Archives/Public/ietf-http-wg/2016JanMar/0155.html>. | <https://lists.w3.org/Archives/Public/ietf-http- | |||
| wg/2016JanMar/0155.html>. | ||||
| [[anchor15: Use of generic libs vs compactness of field values..]] | ||||
| [[anchor16: Mention potential "Key" header field extension ([KEY]).]] | ||||
| Appendix C. Change Log (to be removed by RFC Editor before publication) | [[CREF1: Use of generic libs vs compactness of field values..]] | |||
| C.1. Since draft-reschke-http-jfv-00 | Appendix E. Change Log (to be removed by RFC Editor before publication) | |||
| E.1. Since draft-reschke-http-jfv-00 | ||||
| Editorial fixes + working on the TODOs. | Editorial fixes + working on the TODOs. | |||
| C.2. Since draft-reschke-http-jfv-01 | E.2. Since draft-reschke-http-jfv-01 | |||
| Mention slightly increased risk of smuggling information in header | Mention slightly increased risk of smuggling information in header | |||
| field values. | field values. | |||
| C.3. Since draft-reschke-http-jfv-02 | E.3. Since draft-reschke-http-jfv-02 | |||
| Mention Kazuho Oku's proposal for abbreviated forms. | Mention Kazuho Oku's proposal for abbreviated forms. | |||
| Added a bit of text about the motivation for a concrete JSON subset | Added a bit of text about the motivation for a concrete JSON subset | |||
| (ack Cory Benfield). | (ack Cory Benfield). | |||
| Expand I18N section. | Expand I18N section. | |||
| C.4. Since draft-reschke-http-jfv-03 | E.4. Since draft-reschke-http-jfv-03 | |||
| Mention relation to KEY header field. | Mention relation to KEY header field. | |||
| C.5. Since draft-reschke-http-jfv-04 | E.5. Since draft-reschke-http-jfv-04 | |||
| Between June and December 2016, this was a work item of the HTTP | Between June and December 2016, this was a work item of the HTTP | |||
| working group (see | working group (see <https://datatracker.ietf.org/doc/draft-ietf- | |||
| <https://datatracker.ietf.org/doc/draft-ietf-httpbis-jfv/>). Work | httpbis-jfv/>). Work (if any) continues now on | |||
| (if any) continues now on | ||||
| <https://datatracker.ietf.org/doc/draft-reschke-http-jfv/>. | <https://datatracker.ietf.org/doc/draft-reschke-http-jfv/>. | |||
| Changes made while this was a work item of the HTTP Working Group: | Changes made while this was a work item of the HTTP Working Group: | |||
| C.5.1. Since draft-ietf-httpbis-jfv-00 | E.6. Since draft-ietf-httpbis-jfv-00 | |||
| Added example for "Accept-Encoding" (inspired by Kazuho's feedback), | Added example for "Accept-Encoding" (inspired by Kazuho's feedback), | |||
| showing a potential way to optimize the format when default values | showing a potential way to optimize the format when default values | |||
| apply. | apply. | |||
| C.5.2. Since draft-ietf-httpbis-jfv-01 | E.7. Since draft-ietf-httpbis-jfv-01 | |||
| Add interop discussion, building on I-JSON and ECMA-262 (see | Add interop discussion, building on I-JSON and ECMA-262 (see | |||
| <https://github.com/httpwg/http-extensions/issues/225>). | <https://github.com/httpwg/http-extensions/issues/225>). | |||
| C.5.3. Since draft-ietf-httpbis-jfv-02 | E.8. Since draft-ietf-httpbis-jfv-02 | |||
| Move non-essential parts into appendix. | Move non-essential parts into appendix. | |||
| Updated XHR reference. | Updated XHR reference. | |||
| Appendix D. Acknowledgements | E.9. Since draft-reschke-http-jfv-05 | |||
| Add meat to "Using this Format in Header Field Definitions". | ||||
| Add a few lines on the relation to "Key". | ||||
| Summarize current use of the format. | ||||
| Acknowledgements | ||||
| Thanks go to the Hypertext Transfer Protocol Working Group | Thanks go to the Hypertext Transfer Protocol Working Group | |||
| participants. | participants. | |||
| Author's Address | Author's Address | |||
| Julian F. Reschke | Julian F. Reschke | |||
| greenbytes GmbH | greenbytes GmbH | |||
| Hafenweg 16 | Hafenweg 16 | |||
| Muenster, NW 48155 | Muenster, NW 48155 | |||
| End of changes. 43 change blocks. | ||||
| 126 lines changed or deleted | 222 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/ | ||||