draft-reschke-http-jfv-14.txt   draft-reschke-http-jfv-latest.txt 
Network Working Group J. F. Reschke Network Working Group J. F. Reschke
Internet-Draft greenbytes Internet-Draft greenbytes
Intended status: Informational April 22, 2021 Intended status: Informational November 10, 2023
Expires: October 24, 2021 Expires: May 13, 2024
A JSON Encoding for HTTP Field Values A JSON Encoding for HTTP Field Values
draft-reschke-http-jfv-14 draft-reschke-http-jfv-latest
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 new HTTP fields. values in new HTTP fields.
Editorial Note Editorial Note
This note is to be removed before publishing as an RFC. This note is to be removed before publishing as an RFC.
skipping to change at page 1, line 34 skipping to change at page 1, line 34
sending a message with subject "subscribe" to ietf-http-wg- sending a message with subject "subscribe" to ietf-http-wg-
request@w3.org (mailto:ietf-http-wg- request@w3.org (mailto:ietf-http-wg-
request@w3.org?subject=subscribe). request@w3.org?subject=subscribe).
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 D.17. The changes in this draft are summarized in Appendix D.18.
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 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 October 24, 2021. This Internet-Draft will expire on May 13, 2024.
Copyright Notice Copyright Notice
Copyright (c) 2021 IETF Trust and the persons identified as the Copyright (c) 2023 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 (https://trustee.ietf.org/ Provisions Relating to IETF Documents (https://trustee.ietf.org/
license-info) in effect on the date of publication of this document. license-info) in effect on the date of publication of this document.
Please review these documents carefully, as they describe your rights Please review these documents carefully, as they describe your rights
and restrictions with respect to this document. Code Components and restrictions with respect to this document. Code Components
extracted from this document must include Revised BSD License text as extracted from this document must include Revised BSD License text as
described in Section 4.e of the Trust Legal Provisions and are described in Section 4.e of the Trust Legal Provisions and are
provided without warranty as described in the Revised BSD License. provided without warranty as described in the Revised BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1. Relation to "Structured Field Values for HTTP" 1.1. Relation to "Structured Field Values for HTTP"
(RFC8941) . . . . . . . . . . . . . . . . . . . . . . . . 4 (RFC8941) . . . . . . . . . . . . . . . . . . . . . . . . 4
2. Data Model and Format . . . . . . . . . . . . . . . . . . . . 4 2. Data Model and Format . . . . . . . . . . . . . . . . . . . . 4
3. Sender Requirements . . . . . . . . . . . . . . . . . . . . . 5 3. Sender Requirements . . . . . . . . . . . . . . . . . . . . . 5
3.1. Example . . . . . . . . . . . . . . . . . . . . . . . . . 5 3.1. Example . . . . . . . . . . . . . . . . . . . . . . . . . 6
4. Recipient Requirements . . . . . . . . . . . . . . . . . . . 6 4. Recipient Requirements . . . . . . . . . . . . . . . . . . . 6
4.1. Example . . . . . . . . . . . . . . . . . . . . . . . . . 6 4.1. Example . . . . . . . . . . . . . . . . . . . . . . . . . 6
5. Using this Format in Field Definitions . . . . . . . . . . . 7 5. Using this Format in Field Definitions . . . . . . . . . . . 7
6. Deployment Considerations . . . . . . . . . . . . . . . . . . 7 6. Deployment Considerations . . . . . . . . . . . . . . . . . . 7
7. Interoperability Considerations . . . . . . . . . . . . . . . 7 7. Interoperability Considerations . . . . . . . . . . . . . . . 8
7.1. Encoding and Characters . . . . . . . . . . . . . . . . . 7 7.1. Encoding and Characters . . . . . . . . . . . . . . . . . 8
7.2. Numbers . . . . . . . . . . . . . . . . . . . . . . . . . 8 7.2. Numbers . . . . . . . . . . . . . . . . . . . . . . . . . 8
7.3. Object Constraints . . . . . . . . . . . . . . . . . . . 8 7.3. Object Constraints . . . . . . . . . . . . . . . . . . . 8
8. Internationalization Considerations . . . . . . . . . . . . . 8 8. Internationalization Considerations . . . . . . . . . . . . . 8
9. Security Considerations . . . . . . . . . . . . . . . . . . . 8 9. Security Considerations . . . . . . . . . . . . . . . . . . . 9
10. References . . . . . . . . . . . . . . . . . . . . . . . . . 9 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 9
10.1. Normative References . . . . . . . . . . . . . . . . . . 9 10.1. Normative References . . . . . . . . . . . . . . . . . . 9
10.2. Informative References . . . . . . . . . . . . . . . . . 9 10.2. Informative References . . . . . . . . . . . . . . . . . 9
10.3. Specifications Using This Syntax (at some point of 10.3. Specifications Using This Syntax (at some point of
time) . . . . . . . . . . . . . . . . . . . . . . . . . 10 time) . . . . . . . . . . . . . . . . . . . . . . . . . 10
Appendix A. Comparison with Structured Fields . . . . . . . . . 10 Appendix A. Comparison with Structured Fields . . . . . . . . . 11
A.1. Base Types . . . . . . . . . . . . . . . . . . . . . . . 10 A.1. Base Types . . . . . . . . . . . . . . . . . . . . . . . 11
A.2. Structures . . . . . . . . . . . . . . . . . . . . . . . 11 A.2. Structures . . . . . . . . . . . . . . . . . . . . . . . 11
Appendix B. Use of JSON Field Value Encoding in the Wild . . . . 11 Appendix B. Use of JSON Field Value Encoding in the Wild . . . . 12
B.1. W3C Reporting API Specification . . . . . . . . . . . . . 12 B.1. W3C Reporting API Specification . . . . . . . . . . . . . 12
B.2. W3C Clear Site Data Specification . . . . . . . . . . . . 12 B.2. W3C Clear Site Data Specification . . . . . . . . . . . . 12
B.3. W3C Feature Policy Specification . . . . . . . . . . . . 12 B.3. W3C Feature Policy Specification . . . . . . . . . . . . 12
Appendix C. Implementations . . . . . . . . . . . . . . . . . . 12 Appendix C. Implementations . . . . . . . . . . . . . . . . . . 12
Appendix D. Change Log . . . . . . . . . . . . . . . . . . . . . 12 Appendix D. Change Log . . . . . . . . . . . . . . . . . . . . . 12
D.1. Since draft-reschke-http-jfv-00 . . . . . . . . . . . . . 12 D.1. Since draft-reschke-http-jfv-00 . . . . . . . . . . . . . 12
D.2. Since draft-reschke-http-jfv-01 . . . . . . . . . . . . . 12 D.2. Since draft-reschke-http-jfv-01 . . . . . . . . . . . . . 13
D.3. Since draft-reschke-http-jfv-02 . . . . . . . . . . . . . 12 D.3. Since draft-reschke-http-jfv-02 . . . . . . . . . . . . . 13
D.4. Since draft-reschke-http-jfv-03 . . . . . . . . . . . . . 13 D.4. Since draft-reschke-http-jfv-03 . . . . . . . . . . . . . 13
D.5. Since draft-reschke-http-jfv-04 . . . . . . . . . . . . . 13 D.5. Since draft-reschke-http-jfv-04 . . . . . . . . . . . . . 13
D.6. Since draft-ietf-httpbis-jfv-00 . . . . . . . . . . . . . 13 D.6. Since draft-ietf-httpbis-jfv-00 . . . . . . . . . . . . . 13
D.7. Since draft-ietf-httpbis-jfv-01 . . . . . . . . . . . . . 13 D.7. Since draft-ietf-httpbis-jfv-01 . . . . . . . . . . . . . 13
D.8. Since draft-ietf-httpbis-jfv-02 . . . . . . . . . . . . . 13 D.8. Since draft-ietf-httpbis-jfv-02 . . . . . . . . . . . . . 13
D.9. Since draft-reschke-http-jfv-05 . . . . . . . . . . . . . 13 D.9. Since draft-reschke-http-jfv-05 . . . . . . . . . . . . . 13
D.10. Since draft-reschke-http-jfv-06 . . . . . . . . . . . . . 13 D.10. Since draft-reschke-http-jfv-06 . . . . . . . . . . . . . 14
D.11. Since draft-reschke-http-jfv-07 . . . . . . . . . . . . . 13 D.11. Since draft-reschke-http-jfv-07 . . . . . . . . . . . . . 14
D.12. Since draft-reschke-http-jfv-08 . . . . . . . . . . . . . 14 D.12. Since draft-reschke-http-jfv-08 . . . . . . . . . . . . . 14
D.13. Since draft-reschke-http-jfv-09 . . . . . . . . . . . . . 14 D.13. Since draft-reschke-http-jfv-09 . . . . . . . . . . . . . 14
D.14. Since draft-reschke-http-jfv-10 . . . . . . . . . . . . . 14 D.14. Since draft-reschke-http-jfv-10 . . . . . . . . . . . . . 14
D.15. Since draft-reschke-http-jfv-11 . . . . . . . . . . . . . 14 D.15. Since draft-reschke-http-jfv-11 . . . . . . . . . . . . . 14
D.16. Since draft-reschke-http-jfv-12 . . . . . . . . . . . . . 14 D.16. Since draft-reschke-http-jfv-12 . . . . . . . . . . . . . 15
D.17. Since draft-reschke-http-jfv-13 . . . . . . . . . . . . . 14 D.17. Since draft-reschke-http-jfv-13 . . . . . . . . . . . . . 15
D.18. Since draft-reschke-http-jfv-14 . . . . . . . . . . . . . 15
D.19. Since draft-reschke-http-jfv-15 . . . . . . . . . . . . . 15
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 15 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 15
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 15 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 15
1. Introduction 1. Introduction
Defining syntax for new HTTP fields ([HTTP], Section 5) is non- Defining syntax for new HTTP fields ([HTTP], Section 5) is non-
trivial. Among the commonly encountered problems are: 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 fields do use a similarly looking syntax, but it is hard to known fields do use a similarly looking syntax, but it is hard to
skipping to change at page 4, line 30 skipping to change at page 4, line 30
fields, and avoids several potential interoperability problems fields, and avoids several potential interoperability problems
inherent to the use of JSON. inherent to the use of JSON.
In general, that format is preferred for newly defined fields. The In general, that format is preferred for newly defined fields. The
JSON-based format defined by this document might however be useful in JSON-based format defined by this document might however be useful in
case the data that needs to be transferred is already in JSON format, case the data that needs to be transferred is already in JSON format,
or features not covered by "Structured Field Values" are needed. or features not covered by "Structured Field Values" are needed.
See Appendix A for more details. See Appendix A for more details.
*Note:* RFC 8941 is currently being revised; see [SFBIS].
2. Data Model and Format 2. Data Model and Format
In HTTP, field lines with the same field name can occur multiple In HTTP, field lines with the same field name can occur multiple
times within a single message (Section 5.3 of [HTTP]). When this times within a single message (Section 5.3 of [HTTP]). When this
happens, recipients are allowed to combine the field line values happens, recipients are allowed to combine the field line values
using commas as delimiter, forming a combined "field value". This using commas as delimiter, forming a combined "field value". This
rule matches nicely JSON's array format (Section 5 of [RFC8259]). rule matches nicely JSON's array format (Section 5 of [RFC8259]).
Thus, the basic data model used here is the JSON array. Thus, the basic data model used here is the JSON array.
Field definitions that need only a single value can restrict Field definitions that need only a single value can restrict
skipping to change at page 9, line 15 skipping to change at page 9, line 26
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
[HTTP] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, [HTTP] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke,
Ed., "HTTP Semantics", Work in Progress, Internet-Draft, Ed., "HTTP Semantics", RFC 9110, DOI 10.17487/RFC9110,
draft-ietf-httpbis-semantics-15, March 30, 2021, June 2022, <https://www.rfc-editor.org/info/rfc9110>.
<https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-
semantics-15>.
[RFC0020] Cerf, V., "ASCII format for network interchange", STD 80, [RFC0020] Cerf, V., "ASCII format for network interchange", STD 80,
RFC 20, DOI 10.17487/RFC0020, October 1969, RFC 20, DOI 10.17487/RFC0020, October 1969,
<https://www.rfc-editor.org/info/rfc20>. <https://www.rfc-editor.org/info/rfc20>.
[RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for 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,
<https://www.rfc-editor.org/info/rfc5234>. <https://www.rfc-editor.org/info/rfc5234>.
skipping to change at page 10, line 14 skipping to change at page 10, line 24
[RFC6365] Hoffman, P. and J. Klensin, "Terminology Used in [RFC6365] Hoffman, P. and J. Klensin, "Terminology Used in
Internationalization in the IETF", BCP 166, RFC 6365, Internationalization in the IETF", BCP 166, RFC 6365,
DOI 10.17487/RFC6365, September 2011, DOI 10.17487/RFC6365, September 2011,
<https://www.rfc-editor.org/info/rfc6365>. <https://www.rfc-editor.org/info/rfc6365>.
[RFC8941] Nottingham, M. and P-H. Kamp, "Structured Field Values for [RFC8941] Nottingham, M. and P-H. Kamp, "Structured Field Values for
HTTP", RFC 8941, DOI 10.17487/RFC8941, February 2021, HTTP", RFC 8941, DOI 10.17487/RFC8941, February 2021,
<https://www.rfc-editor.org/info/rfc8941>. <https://www.rfc-editor.org/info/rfc8941>.
[SFBIS] Nottingham, M. and P.-H. Kamp, "Structured Field Values
for HTTP", Work in Progress, Internet-Draft, draft-ietf-
httpbis-sfbis-04, November 6, 2023,
<https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-
sfbis-04>.
[XMLHttpRequest] [XMLHttpRequest]
WhatWG, "XMLHttpRequest", <https://xhr.spec.whatwg.org/>. WhatWG, "XMLHttpRequest", <https://xhr.spec.whatwg.org/>.
10.3. Specifications Using This Syntax (at some point of time) 10.3. Specifications Using This Syntax (at some point of time)
[CLEARSITE] [CLEARSITE]
West, M., "Clear Site Data", W3C Working Draft WD-clear- West, M., "Clear Site Data", W3C Working Draft WD-clear-
site-data-20171130, November 30, 2017, site-data-20171130, November 30, 2017,
<https://www.w3.org/TR/2017/WD-clear-site-data-20171130/>. <https://www.w3.org/TR/2017/WD-clear-site-data-20171130/>.
Latest version available at <https://www.w3.org/TR/clear- Latest version available at <https://www.w3.org/TR/clear-
skipping to change at page 10, line 42 skipping to change at page 11, line 9
"Reporting API", W3C Working Draft WD-reporting- "Reporting API", W3C Working Draft WD-reporting-
1-20180925, September 25, 2018, 1-20180925, September 25, 2018,
<https://www.w3.org/TR/2018/WD-reporting-1-20180925/>. <https://www.w3.org/TR/2018/WD-reporting-1-20180925/>.
Latest version available at <https://www.w3.org/TR/ Latest version available at <https://www.w3.org/TR/
reporting-1/>. reporting-1/>.
Appendix A. Comparison with Structured Fields Appendix A. Comparison with Structured Fields
A.1. Base Types A.1. Base Types
+----------+----------------------------------+------------------+ +----------+-----------------------------------+------------------+
| Type | in Structured Fields | in JSON-based | | Type | in Structured Fields | in JSON-based |
| | | Fields | | | | Fields |
+----------+----------------------------------+------------------+ +----------+-----------------------------------+------------------+
| Integer | | Section 6 | | Integer | | Section 6 |
| Integer | (restricted to 15 digits) | | | Integer | (restricted to 15 digits) | |
+----------+ [RFC8941], Section 3.3.2 | [RFC8259], | +----------+ [RFC8941], Section 3.3.2 | [RFC8259], |
| Decimal | | Section 6 | | Decimal | | Section 6 |
| Decimal | (a fixed point decimal | | | Decimal | (a fixed point decimal restricted | |
| | restricted to 12 + 3 digits) | | | | to 12 + 3 digits) | |
+----------+ [RFC8941], Section 3.3.3 | [RFC8259], | +----------+ [RFC8941], Section 3.3.3 | [RFC8259], |
| String | | Section 7 | | String | | Section 7 |
| String | (only ASCII supported, non-ASCII | | | String | (only ASCII supported, non-ASCII | |
| | requires using Byte Sequences) | | | | requires using Byte Sequences; | |
+----------+ [RFC8941], Section 3.3.5 | not available | | | but see Section 3.3.8 of [SFBIS]) | |
+----------+ | (usually mapped | +----------+ [RFC8941], Section 3.3.5 | not available |
| Byte | | to strings using | +----------+ | (usually mapped |
| Sequence | | base64 encoding) | | Byte | | to strings using |
+----------+ [RFC8941], Section 3.3.6 | [RFC8259], | | Sequence | | base64 encoding) |
| Boolean | | Section 3 | +----------+ [RFC8941], Section 3.3.6 | [RFC8259], |
| +----------------------------------+------------------+ | Boolean | | Section 3 |
| +-----------------------------------+------------------+
Table 1 Table 1
Structured Fields provide more data types (such as "token" or "byte Structured Fields provide more data types (such as "token" or "byte
sequence"). Numbers are restricted, avoiding the JSON interop sequence"). Numbers are restricted, avoiding the JSON interop
problems described in Section 7.2. Strings are limited to ASCII, problems described in Section 7.2. Strings are limited to ASCII,
requiring the use of byte sequences should non-ASCII characters be requiring the use of byte sequences should non-ASCII characters be
needed. needed (but see Section 3.3.8 of [SFBIS]).
A.2. Structures A.2. Structures
Structured Fields define Lists ([RFC8941], Section 3.1), similar to Structured Fields define Lists ([RFC8941], Section 3.1), similar to
JSON arrays ([RFC8259], Section 5), and Dictionaries ([RFC8941], JSON arrays ([RFC8259], Section 5), and Dictionaries ([RFC8941],
Section 3.2), similar to JSON objects ([RFC8259], Section 4). Section 3.2), similar to JSON objects ([RFC8259], Section 4).
In addition, most items in Structured Fields can be parametrized In addition, most items in Structured Fields can be parametrized
([RFC8941], Section 3.1.2), attaching a dictionary-like structure to ([RFC8941], Section 3.1.2), attaching a dictionary-like structure to
the value. To emulate this in JSON based field, an additional the value. To emulate this in JSON based field, an additional
skipping to change at page 15, line 12 skipping to change at page 15, line 27
Mention test implementation. Mention test implementation.
Clarify that Unicode unpaired surrogates or Noncharacters must not be Clarify that Unicode unpaired surrogates or Noncharacters must not be
sent. sent.
Rewrite text about [RFC8941], add appendix comparing both formats. Rewrite text about [RFC8941], add appendix comparing both formats.
And send/receive examples. And send/receive examples.
D.18. Since draft-reschke-http-jfv-14
Update HTTP reference.
Mention [SFBIS].
D.19. Since draft-reschke-http-jfv-15
Update [SFBIS] reference.
Acknowledgements 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
 End of changes. 20 change blocks. 
46 lines changed or deleted 65 lines changed or added

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