draft-ietf-httpbis-jfv-02.txt | draft-ietf-httpbis-jfv-latest.txt | |||
---|---|---|---|---|
HTTP Working Group J. Reschke | HTTP Working Group J. Reschke | |||
Internet-Draft greenbytes | Internet-Draft greenbytes | |||
Intended status: Standards Track October 24, 2016 | Intended status: Standards Track July 6, 2024 | |||
Expires: April 27, 2017 | Expires: January 7, 2025 | |||
A JSON Encoding for HTTP Header Field Values | A JSON Encoding for HTTP Header Field Values | |||
draft-ietf-httpbis-jfv-02 | draft-ietf-httpbis-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 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) | |||
Discussion of this draft takes place on the HTTPBIS working group | Discussion of this draft takes place on the HTTPBIS working group | |||
mailing list (ietf-http-wg@w3.org), which is archived at | mailing list (ietf-http-wg@w3.org), which is archived at | |||
<https://lists.w3.org/Archives/Public/ietf-http-wg/>. | <https://lists.w3.org/Archives/Public/ietf-http-wg/>. | |||
Working Group information can be found at <http://httpwg.github.io/>; | Working Group information can be found at <http://httpwg.github.io/>; | |||
source code and issues list for this draft can be found at | source code and issues list for this draft can be found at | |||
<https://github.com/httpwg/http-extensions>. | <https://github.com/httpwg/http-extensions>. | |||
The changes in this draft are summarized in Appendix A. | The changes in this draft are summarized in Appendix C. | |||
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 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 April 27, 2017. | This Internet-Draft will expire on January 7, 2025. | |||
Copyright Notice | Copyright Notice | |||
Copyright (c) 2016 IETF Trust and the persons identified as the | Copyright (c) 2024 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 | (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 | |||
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 . . . . . . . . . . . . . . . . . . . . 3 | |||
3. Sender Requirements . . . . . . . . . . . . . . . . . . . . . 4 | 3. Sender Requirements . . . . . . . . . . . . . . . . . . . . . 4 | |||
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. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 | 6. Deployment Considerations . . . . . . . . . . . . . . . . . . 5 | |||
6.1. Content-Length . . . . . . . . . . . . . . . . . . . . . . 5 | 7. Interoperability Considerations . . . . . . . . . . . . . . . 5 | |||
6.2. Content-Disposition . . . . . . . . . . . . . . . . . . . 6 | 7.1. Encoding and Characters . . . . . . . . . . . . . . . . . 5 | |||
6.3. WWW-Authenticate . . . . . . . . . . . . . . . . . . . . . 7 | 7.2. Numbers . . . . . . . . . . . . . . . . . . . . . . . . . 6 | |||
6.4. Accept-Encoding . . . . . . . . . . . . . . . . . . . . . 8 | 7.3. Object Constraints . . . . . . . . . . . . . . . . . . . 6 | |||
7. Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . 9 | 8. Internationalization Considerations . . . . . . . . . . . . . 6 | |||
8. Deployment Considerations . . . . . . . . . . . . . . . . . . 9 | 9. Security Considerations . . . . . . . . . . . . . . . . . . . 6 | |||
9. Interoperability Considerations . . . . . . . . . . . . . . . 9 | 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 7 | |||
9.1. Encoding and Characters . . . . . . . . . . . . . . . . . 9 | 10.1. Normative References . . . . . . . . . . . . . . . . . . 7 | |||
9.2. Numbers . . . . . . . . . . . . . . . . . . . . . . . . . 10 | 10.2. Informative References . . . . . . . . . . . . . . . . . 7 | |||
9.3. Object Constraints . . . . . . . . . . . . . . . . . . . . 10 | Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 9 | |||
10. Internationalization Considerations . . . . . . . . . . . . . 10 | A.1. Content-Length . . . . . . . . . . . . . . . . . . . . . 9 | |||
11. Security Considerations . . . . . . . . . . . . . . . . . . . 10 | A.2. Content-Disposition . . . . . . . . . . . . . . . . . . . 9 | |||
12. References . . . . . . . . . . . . . . . . . . . . . . . . . . 11 | A.3. WWW-Authenticate . . . . . . . . . . . . . . . . . . . . 10 | |||
12.1. Normative References . . . . . . . . . . . . . . . . . . . 11 | A.4. Accept-Encoding . . . . . . . . . . . . . . . . . . . . . 11 | |||
12.2. Informative References . . . . . . . . . . . . . . . . . . 11 | Appendix B. Discussion . . . . . . . . . . . . . . . . . . . . . 12 | |||
Appendix A. Change Log (to be removed by RFC Editor before | Appendix C. Change Log (to be removed by RFC Editor before | |||
publication) . . . . . . . . . . . . . . . . . . . . 12 | publication) . . . . . . . . . . . . . . . . . . . . 13 | |||
A.1. Since draft-reschke-http-jfv-00 . . . . . . . . . . . . . 12 | C.1. Since draft-reschke-http-jfv-00 . . . . . . . . . . . . . 13 | |||
A.2. Since draft-reschke-http-jfv-01 . . . . . . . . . . . . . 12 | C.2. Since draft-reschke-http-jfv-01 . . . . . . . . . . . . . 13 | |||
A.3. Since draft-reschke-http-jfv-02 . . . . . . . . . . . . . 12 | C.3. Since draft-reschke-http-jfv-02 . . . . . . . . . . . . . 13 | |||
A.4. Since draft-reschke-http-jfv-03 . . . . . . . . . . . . . 13 | C.4. Since draft-reschke-http-jfv-03 . . . . . . . . . . . . . 13 | |||
A.5. Since draft-reschke-http-jfv-04 . . . . . . . . . . . . . 13 | C.5. Since draft-reschke-http-jfv-04 . . . . . . . . . . . . . 13 | |||
A.6. Since draft-ietf-httpbis-jfv-00 . . . . . . . . . . . . . 13 | C.6. Since draft-ietf-httpbis-jfv-00 . . . . . . . . . . . . . 13 | |||
A.7. Since draft-ietf-httpbis-jfv-01 . . . . . . . . . . . . . 13 | C.7. Since draft-ietf-httpbis-jfv-01 . . . . . . . . . . . . . 13 | |||
Appendix B. Acknowledgements . . . . . . . . . . . . . . . . . . 13 | C.8. Since draft-ietf-httpbis-jfv-02 . . . . . . . . . . . . . 14 | |||
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 14 | ||||
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 14 | ||||
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 5, line 31 ¶ | skipping to change at page 5, line 31 ¶ | |||
("]") 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 | [[CREF1: Explain what a definition of a new header field needs to do | |||
do precisely to use this format, mention must-ignore extensibility]] | precisely to use this format, mention must-ignore extensibility]] | |||
6. Examples | 6. Deployment Considerations | |||
This JSON-based syntax will only apply to newly introduced header | ||||
fields, thus backwards compatibility is not a problem. That being | ||||
said, it is conceivable that there is existing code that might trip | ||||
over double quotes not being used for HTTP's quoted-string syntax | ||||
(Section 3.2.6 of [RFC7230]). | ||||
7. Interoperability Considerations | ||||
The "I-JSON Message Format" specification ([RFC7493]) addresses known | ||||
JSON interoperability pain points. This specification borrows from | ||||
the requirements made over there: | ||||
7.1. Encoding and Characters | ||||
This specification requires that field values use only US-ASCII | ||||
characters, and thus by definition use a subset of UTF-8 (Section 2.1 | ||||
of [RFC7493]). | ||||
7.2. Numbers | ||||
Be aware of the issues around number precision, as discussed in | ||||
Section 2.2 of [RFC7493]. | ||||
7.3. Object Constraints | ||||
As described in Section 4 of [RFC7159], JSON parser implementations | ||||
differ in the handling of duplicate object names. Therefore, senders | ||||
MUST NOT use duplicate object names, and recipients SHOULD either | ||||
treat field values with duplicate names as invalid (consistent with | ||||
[RFC7493], Section 2.3) or use the lexically last value (consistent | ||||
with [ECMA-262], Section 24.3.1.1). | ||||
Furthermore, ordering of object members is not significant and can | ||||
not be relied upon. | ||||
8. Internationalization Considerations | ||||
In HTTP/1.1, header field values are represented by octet sequences, | ||||
usually used to transmit ASCII characters, with restrictions on the | ||||
use of certain control characters, and no associated default | ||||
character encoding, nor a way to describe it ([RFC7230], | ||||
Section 3.2). HTTP/2 does not change this. | ||||
This specification maps all characters which can cause problems to | ||||
JSON escape sequences, thereby solving the HTTP header field | ||||
internationalization problem. | ||||
Future specifications of HTTP might change to allow non-ASCII | ||||
characters natively. In that case, header fields using the syntax | ||||
defined by this specification would have a simple migration path (by | ||||
just stopping to require escaping of non-ASCII characters). | ||||
9. Security Considerations | ||||
Using JSON-shaped field values is believed to not introduce any new | ||||
threads beyond those described in Section 12 of [RFC7159], namely the | ||||
risk of recipients using the wrong tools to parse them. | ||||
Other than that, any syntax that makes extensions easy can be used to | ||||
smuggle information through field values; however, this concern is | ||||
shared with other widely used formats, such as those using parameters | ||||
in the form of name/value pairs. | ||||
10. References | ||||
10.1. Normative References | ||||
[RFC0020] Cerf, V., "ASCII format for network interchange", STD 80, | ||||
RFC 20, DOI 10.17487/RFC0020, October 1969, | ||||
<https://www.rfc-editor.org/info/rfc20>. | ||||
[RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax | ||||
Specifications: ABNF", STD 68, RFC 5234, | ||||
DOI 10.17487/RFC5234, January 2008, | ||||
<https://www.rfc-editor.org/info/rfc5234>. | ||||
[RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data | ||||
Interchange Format", RFC 7159, DOI 10.17487/RFC7159, March | ||||
2014, <https://www.rfc-editor.org/info/rfc7159>. | ||||
[RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer | ||||
Protocol (HTTP/1.1): Message Syntax and Routing", | ||||
RFC 7230, DOI 10.17487/RFC7230, June 2014, | ||||
<https://www.rfc-editor.org/info/rfc7230>. | ||||
[RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer | ||||
Protocol (HTTP/1.1): Semantics and Content", RFC 7231, | ||||
DOI 10.17487/RFC7231, June 2014, | ||||
<https://www.rfc-editor.org/info/rfc7231>. | ||||
[RFC7493] Bray, T., Ed., "The I-JSON Message Format", RFC 7493, | ||||
DOI 10.17487/RFC7493, March 2015, | ||||
<https://www.rfc-editor.org/info/rfc7493>. | ||||
10.2. Informative References | ||||
[ECMA-262] | ||||
Ecma International, "ECMA-262 6th Edition, The ECMAScript | ||||
2015 Language Specification", Standard ECMA-262, June | ||||
2015, <http://www.ecma-international.org/ecma-262/6.0/>. | ||||
[ISO-8859-1] | ||||
International Organization for Standardization, | ||||
"Information technology -- 8-bit single-byte coded graphic | ||||
character sets -- Part 1: Latin alphabet No. 1", ISO/ | ||||
IEC 8859-1:1998, 1998. | ||||
[KEY] Fielding, R. and M. Nottingham, "The Key HTTP Response | ||||
Header Field", draft-ietf-httpbis-key-01 (work in | ||||
progress), March 2016. | ||||
[RFC5987] Reschke, J., "Character Set and Language Encoding for | ||||
Hypertext Transfer Protocol (HTTP) Header Field | ||||
Parameters", RFC 5987, DOI 10.17487/RFC5987, August 2010, | ||||
<https://www.rfc-editor.org/info/rfc5987>. | ||||
[RFC6266] Reschke, J., "Use of the Content-Disposition Header Field | ||||
in the Hypertext Transfer Protocol (HTTP)", RFC 6266, | ||||
DOI 10.17487/RFC6266, June 2011, | ||||
<https://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, | ||||
<https://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, | ||||
<https://www.rfc-editor.org/info/rfc7235>. | ||||
[XMLHttpRequest] | ||||
WhatWG, "XMLHttpRequest", <https://xhr.spec.whatwg.org/>. | ||||
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. | |||
6.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 6, line 20 ¶ | skipping to change at page 9, line 40 ¶ | |||
...and the prose definition would: | ...and the prose definition would: | |||
o restrict all numbers to be non-negative integers without | o restrict all numbers to be non-negative integers without | |||
fractions, and | fractions, and | |||
o require that the array of values is of length 1 (but allow the | o require that the array of values is of length 1 (but allow the | |||
case where the array is longer, but all members represent the same | case where the array is longer, but all members represent the same | |||
value) | value) | |||
6.2. Content-Disposition | A.2. Content-Disposition | |||
Content-Disposition field values, defined in [RFC6266], consist of a | Content-Disposition field values, defined in [RFC6266], consist of a | |||
"disposition type" (a string), plus multiple parameters, of which at | "disposition type" (a string), plus multiple parameters, of which at | |||
least one ("filename") sometime needs to carry non-ASCII characters. | least one ("filename") sometime needs to carry non-ASCII characters. | |||
For instance, the first example in Section 5 of [RFC6266]: | For instance, the first example in Section 5 of [RFC6266]: | |||
Attachment; filename=example.html | Attachment; filename=example.html | |||
has a disposition type of "Attachment", with filename parameter value | has a disposition type of "Attachment", with filename parameter value | |||
skipping to change at page 7, line 10 ¶ | skipping to change at page 10, line 31 ¶ | |||
defined in [RFC5987], representing a filename starting with the | defined in [RFC5987], representing a filename starting with the | |||
Unicode character U+20AC (EURO SIGN), followed by " rates". If the | Unicode character U+20AC (EURO SIGN), followed by " rates". If the | |||
definition of Content-Disposition would have used the format proposed | definition of Content-Disposition would have used the format proposed | |||
here, the workaround involving the "parameter*" syntax would not have | here, the workaround involving the "parameter*" syntax would not have | |||
been needed at all. | been needed at all. | |||
The JSON representation of this value could then be: | The JSON representation of this value could then be: | |||
{ "attachment": { "filename" : "\u20AC rates" } } | { "attachment": { "filename" : "\u20AC rates" } } | |||
6.3. WWW-Authenticate | A.3. WWW-Authenticate | |||
The WWW-Authenticate header field value is defined in Section 4.1 of | The WWW-Authenticate header field value is defined in Section 4.1 of | |||
[RFC7235] as a list of "challenges": | [RFC7235] as a list of "challenges": | |||
WWW-Authenticate = 1#challenge | WWW-Authenticate = 1#challenge | |||
...where a challenge consists of a scheme with optional parameters: | ...where a challenge consists of a scheme with optional parameters: | |||
challenge = auth-scheme [ 1*SP ( token68 / #auth-param ) ] | challenge = auth-scheme [ 1*SP ( token68 / #auth-param ) ] | |||
skipping to change at page 8, line 5 ¶ | skipping to change at page 11, line 26 ¶ | |||
} | } | |||
} | } | |||
] | ] | |||
...which would translate to a header field value of: | ...which would translate to a header field value of: | |||
{ "Newauth" : { "realm": "apps", "type" : 1, | { "Newauth" : { "realm": "apps", "type" : 1, | |||
"title": "Login to \"apps\"" }}, | "title": "Login to \"apps\"" }}, | |||
{ "Basic" : { "realm": "simple"}} | { "Basic" : { "realm": "simple"}} | |||
6.4. Accept-Encoding | A.4. Accept-Encoding | |||
The Accept-Encoding header field value is defined in Section 5.3.4 of | The Accept-Encoding header field value is defined in Section 5.3.4 of | |||
[RFC7231] as a list of codings, each of which allowing a weight | [RFC7231] as a list of codings, each of which allowing a weight | |||
parameter 'q': | parameter 'q': | |||
Accept-Encoding = #( codings [ weight ] ) | Accept-Encoding = #( codings [ weight ] ) | |||
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 9, line 19 ¶ | skipping to change at page 12, 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. | |||
7. Discussion | Appendix B. 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>. | ||||
[[anchor7: Use of generic libs vs compactness of field values..]] | ||||
[[anchor8: Mention potential "Key" header field extension ([KEY]).]] | ||||
8. Deployment Considerations | ||||
This JSON-based syntax will only apply to newly introduced header | ||||
fields, thus backwards compatibility is not a problem. That being | ||||
said, it is conceivable that there is existing code that might trip | ||||
over double quotes not being used for HTTP's quoted-string syntax | ||||
(Section 3.2.6 of [RFC7230]). | ||||
9. Interoperability Considerations | ||||
The "I-JSON Message Format" specification ([RFC7493]) addresses known | ||||
JSON interoperability pain points. This specification borrows from | ||||
the requirements made over there: | ||||
9.1. Encoding and Characters | ||||
This specification requires that field values use only US-ASCII | ||||
characters, and thus by definition use a subset of UTF-8 (Section 2.1 | ||||
of [RFC7493]). | ||||
9.2. Numbers | ||||
Be aware of the issues around number precision, as discussed in | ||||
Section 2.2 of [RFC7493]. | ||||
9.3. Object Constraints | ||||
As described in Section 4 of [RFC7159], JSON parser implementations | ||||
differ in the handling of duplicate object names. Therefore, senders | ||||
MUST NOT use duplicate object names, and recipients SHOULD either | ||||
treat field values with duplicate names as invalid (consistent with | ||||
[RFC7493], Section 2.3) or use the lexically last value (consistent | ||||
with [ECMA-262], Section 24.3.1.1). | ||||
Furthermore, ordering of object members is not significant and can | ||||
not be relied upon. | ||||
10. Internationalization Considerations | ||||
In HTTP/1.1, header field values are represented by octet sequences, | ||||
usually used to transmit ASCII characters, with restrictions on the | ||||
use of certain control characters, and no associated default | ||||
character encoding, nor a way to describe it ([RFC7230], Section | ||||
3.2). HTTP/2 does not change this. | ||||
This specification maps all characters which can cause problems to | ||||
JSON escape sequences, thereby solving the HTTP header field | ||||
internationalization problem. | ||||
Future specifications of HTTP might change to allow non-ASCII | ||||
characters natively. In that case, header fields using the syntax | ||||
defined by this specification would have a simple migration path (by | ||||
just stopping to require escaping of non-ASCII characters). | ||||
11. Security Considerations | ||||
Using JSON-shaped field values is believed to not introduce any new | ||||
threads beyond those described in Section 12 of [RFC7159], namely the | ||||
risk of recipients using the wrong tools to parse them. | ||||
Other than that, any syntax that makes extensions easy can be used to | ||||
smuggle information through field values; however, this concern is | ||||
shared with other widely used formats, such as those using parameters | ||||
in the form of name/value pairs. | ||||
12. References | ||||
12.1. Normative References | ||||
[RFC0020] Cerf, V., "ASCII format for network interchange", | ||||
STD 80, RFC 20, DOI 10.17487/RFC0020, October 1969, | ||||
<http://www.rfc-editor.org/info/rfc20>. | ||||
[RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for | ||||
Syntax Specifications: ABNF", STD 68, RFC 5234, | ||||
DOI 10.17487/RFC5234, January 2008, | ||||
<http://www.rfc-editor.org/info/rfc5234>. | ||||
[RFC7159] Bray, T., "The JavaScript Object Notation (JSON) | ||||
Data Interchange Format", RFC 7159, DOI 10.17487/ | ||||
RFC7159, March 2014, | ||||
<http://www.rfc-editor.org/info/rfc7159>. | ||||
[RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext | ||||
Transfer Protocol (HTTP/1.1): Message Syntax and | ||||
Routing", RFC 7230, DOI 10.17487/RFC7230, | ||||
June 2014, | ||||
<http://www.rfc-editor.org/info/rfc7230>. | ||||
[RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext | ||||
Transfer Protocol (HTTP/1.1): Semantics and | ||||
Content", RFC 7231, DOI 10.17487/RFC7231, | ||||
June 2014, | ||||
<http://www.rfc-editor.org/info/rfc7231>. | ||||
[RFC7493] Bray, T., Ed., "The I-JSON Message Format", | ||||
RFC 7493, DOI 10.17487/RFC7493, March 2015, | ||||
<http://www.rfc-editor.org/info/rfc7493>. | ||||
12.2. Informative References | ||||
[ECMA-262] Ecma International, "ECMA-262 6th Edition, The | ||||
ECMAScript 2015 Language Specification", | ||||
Standard ECMA-262, June 2015, | ||||
<http://www.ecma-international.org/ecma-262/6.0/>. | ||||
[ISO-8859-1] International Organization for Standardization, | ||||
"Information technology -- 8-bit single-byte coded | ||||
graphic character sets -- Part 1: Latin alphabet | ||||
No. 1", ISO/IEC 8859-1:1998, 1998. | ||||
[KEY] Fielding, R. and M. Nottingham, "The Key HTTP | ||||
Response Header Field", draft-ietf-httpbis-key-01 | ||||
(work in progress), March 2016. | ||||
[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>. | ||||
[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] van Kesteren, A., Aubourg, J., Song, J., and H. | [[CREF2: Use of generic libs vs compactness of field values..]] | |||
Steen, "XMLHttpRequest Level 1", W3C Working | ||||
Draft WD-XMLHttpRequest-20140130, January 2014, <ht | ||||
tp://www.w3.org/TR/2014/ | ||||
WD-XMLHttpRequest-20140130/>. | ||||
Latest version available at | [[CREF3: Mention potential "Key" header field extension ([KEY]).]] | |||
<http://www.w3.org/TR/XMLHttpRequest/>. | ||||
Appendix A. Change Log (to be removed by RFC Editor before publication) | Appendix C. Change Log (to be removed by RFC Editor before publication) | |||
A.1. Since draft-reschke-http-jfv-00 | C.1. Since draft-reschke-http-jfv-00 | |||
Editorial fixes + working on the TODOs. | Editorial fixes + working on the TODOs. | |||
A.2. Since draft-reschke-http-jfv-01 | C.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. | |||
A.3. Since draft-reschke-http-jfv-02 | C.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. | |||
A.4. Since draft-reschke-http-jfv-03 | C.4. Since draft-reschke-http-jfv-03 | |||
Mention relation to KEY header field. | Mention relation to KEY header field. | |||
A.5. Since draft-reschke-http-jfv-04 | C.5. Since draft-reschke-http-jfv-04 | |||
Change to HTTP Working Group draft. | Change to HTTP Working Group draft. | |||
A.6. Since draft-ietf-httpbis-jfv-00 | C.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. | |||
A.7. Since draft-ietf-httpbis-jfv-01 | C.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>). | |||
Appendix B. Acknowledgements | C.8. Since draft-ietf-httpbis-jfv-02 | |||
Move non-essential parts into appendix. | ||||
Updated XHR reference. | ||||
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. 29 change blocks. | ||||
208 lines changed or deleted | 209 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/ |