idnits 2.17.1 draft-reschke-rfc2231-in-http-08.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** You're using the IETF Trust Provisions' Section 6.b License Notice from 12 Sep 2009 rather than the newer Notice from 28 Dec 2009. (See https://trustee.ietf.org/license-info/) Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The abstract seems to contain references ([2], [1]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (January 19, 2010) is 5210 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Possible downref: Non-RFC (?) normative reference: ref. 'ISO-8859-1' ** Obsolete normative reference: RFC 2616 (Obsoleted by RFC 7230, RFC 7231, RFC 7232, RFC 7233, RFC 7234, RFC 7235) -- Obsolete informational reference (is this intentional?): RFC 2388 (Obsoleted by RFC 7578) Summary: 3 errors (**), 0 flaws (~~), 1 warning (==), 4 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group J. Reschke 3 Internet-Draft greenbytes 4 Intended status: Standards Track January 19, 2010 5 Expires: July 23, 2010 7 Application of RFC 2231 Encoding to 8 Hypertext Transfer Protocol (HTTP) Header Fields 9 draft-reschke-rfc2231-in-http-08 11 Abstract 13 By default, message header field parameters in Hypertext Transfer 14 Protocol (HTTP) messages can not carry characters outside the ISO- 15 8859-1 character set. RFC 2231 defines an escaping mechanism for use 16 in Multipurpose Internet Mail Extensions (MIME) headers. This 17 document specifies a profile of that encoding suitable for use in 18 HTTP header fields. 20 Editorial Note (To be removed by RFC Editor before publication) 22 There are multiple HTTP header fields that already use RFC 2231 23 encoding in practice (Content-Disposition) or might use it in the 24 future (Link). The purpose of this document is to provide a single 25 place where the generic aspects of RFC 2231 encoding in HTTP header 26 fields are defined. 28 Distribution of this document is unlimited. Although this is not a 29 work item of the HTTPbis Working Group, comments should be sent to 30 the Hypertext Transfer Protocol (HTTP) mailing list at 31 ietf-http-wg@w3.org [1], which may be joined by sending a message 32 with subject "subscribe" to ietf-http-wg-request@w3.org [2]. 34 Discussions of the HTTPbis Working Group are archived at 35 . 37 XML versions, latest edits and the issues list for this document are 38 available from 39 . A 40 collection of test cases is available at 41 . 43 Note: as of January 2010, there were at least three independent 44 implementations of the encoding defined in Section 3.2: Konqueror 45 (trunk), Mozilla Firefox, and Opera. 47 Status of this Memo 48 This Internet-Draft is submitted to IETF in full conformance with the 49 provisions of BCP 78 and BCP 79. 51 Internet-Drafts are working documents of the Internet Engineering 52 Task Force (IETF), its areas, and its working groups. Note that 53 other groups may also distribute working documents as Internet- 54 Drafts. 56 Internet-Drafts are draft documents valid for a maximum of six months 57 and may be updated, replaced, or obsoleted by other documents at any 58 time. It is inappropriate to use Internet-Drafts as reference 59 material or to cite them other than as "work in progress." 61 The list of current Internet-Drafts can be accessed at 62 http://www.ietf.org/ietf/1id-abstracts.txt. 64 The list of Internet-Draft Shadow Directories can be accessed at 65 http://www.ietf.org/shadow.html. 67 This Internet-Draft will expire on July 23, 2010. 69 Copyright Notice 71 Copyright (c) 2010 IETF Trust and the persons identified as the 72 document authors. All rights reserved. 74 This document is subject to BCP 78 and the IETF Trust's Legal 75 Provisions Relating to IETF Documents 76 (http://trustee.ietf.org/license-info) in effect on the date of 77 publication of this document. Please review these documents 78 carefully, as they describe your rights and restrictions with respect 79 to this document. Code Components extracted from this document must 80 include Simplified BSD License text as described in Section 4.e of 81 the Trust Legal Provisions and are provided without warranty as 82 described in the BSD License. 84 Table of Contents 86 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 87 2. Notational Conventions . . . . . . . . . . . . . . . . . . . . 4 88 3. A Profile of RFC 2231 for Use in HTTP . . . . . . . . . . . . 4 89 3.1. Parameter Continuations . . . . . . . . . . . . . . . . . 5 90 3.2. Parameter Value Character Set and Language Information . . 5 91 3.2.1. Examples . . . . . . . . . . . . . . . . . . . . . . . 7 92 3.3. Language specification in Encoded Words . . . . . . . . . 8 93 4. Guidelines for Usage in HTTP Header Field Definitions . . . . 8 94 4.1. When to Use the Extension . . . . . . . . . . . . . . . . 8 95 4.2. Error Handling . . . . . . . . . . . . . . . . . . . . . . 9 96 4.3. Using Multiple Instances for Internationalization . . . . 9 97 5. Security Considerations . . . . . . . . . . . . . . . . . . . 10 98 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 10 99 7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 10 100 8. References . . . . . . . . . . . . . . . . . . . . . . . . . . 10 101 8.1. Normative References . . . . . . . . . . . . . . . . . . . 10 102 8.2. Informative References . . . . . . . . . . . . . . . . . . 10 103 Appendix A. Document History and Future Plans (to be removed 104 by RFC Editor before publication) . . . . . . . . . . 11 105 Appendix B. Change Log (to be removed by RFC Editor before 106 publication) . . . . . . . . . . . . . . . . . . . . 12 107 B.1. Since draft-reschke-rfc2231-in-http-00 . . . . . . . . . . 12 108 B.2. Since draft-reschke-rfc2231-in-http-01 . . . . . . . . . . 12 109 B.3. Since draft-reschke-rfc2231-in-http-02 . . . . . . . . . . 12 110 B.4. Since draft-reschke-rfc2231-in-http-03 . . . . . . . . . . 12 111 B.5. Since draft-reschke-rfc2231-in-http-04 . . . . . . . . . . 12 112 B.6. Since draft-reschke-rfc2231-in-http-05 . . . . . . . . . . 12 113 B.7. Since draft-reschke-rfc2231-in-http-06 . . . . . . . . . . 13 114 B.8. Since draft-reschke-rfc2231-in-http-07 . . . . . . . . . . 13 115 Appendix C. Resolved issues (to be removed by RFC Editor 116 before publication) . . . . . . . . . . . . . . . . . 13 117 C.1. edit . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 118 C.2. impl . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 119 C.3. rel-2388 . . . . . . . . . . . . . . . . . . . . . . . . . 13 120 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 13 122 1. Introduction 124 By default, message header field parameters in HTTP ([RFC2616]) 125 messages can not carry characters outside the ISO-8859-1 character 126 set ([ISO-8859-1]). RFC 2231 ([RFC2231]) defines an escaping 127 mechanism for use in MIME headers. This document specifies a profile 128 of that encoding for use in HTTP header fields. 130 Note: this profile does not apply to message payloads transmitted 131 over HTTP, such as when using the media type "multipart/form-data" 132 ([RFC2388]). 134 2. Notational Conventions 136 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 137 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 138 document are to be interpreted as described in [RFC2119]. 140 This specification uses the ABNF (Augmented Backus-Naur Form) 141 notation defined in [RFC5234]. The following core rules are included 142 by reference, as defined in [RFC5234], Appendix B.1: ALPHA (letters), 143 DIGIT (decimal 0-9), HEXDIG (hexadecimal 0-9/A-F/a-f) and LWSP 144 (linear white space). 146 Note that this specification uses the term "character set" for 147 consistency with other IETF specifications such as RFC 2277 (see 148 [RFC2277], Section 3). A more accurate term would be "character 149 encoding" (a mapping of code points to octet sequences). 151 3. A Profile of RFC 2231 for Use in HTTP 153 RFC 2231 defines several extensions to MIME. The sections below 154 discuss if and how they apply to HTTP. 156 In short: 158 o Parameter Continuations aren't needed (Section 3.1), 160 o Character Set and Language Information are useful, therefore a 161 simple subset is specified (Section 3.2), and 163 o Language Specifications in Encoded Words aren't needed 164 (Section 3.3). 166 3.1. Parameter Continuations 168 Section 3 of [RFC2231] defines a mechanism that deals with the length 169 limitations that apply to MIME headers. These limitations do not 170 apply to HTTP ([RFC2616], Section 19.4.7). 172 Thus in HTTP, senders MUST NOT use parameter continuations, and 173 therefore recipients do not need to support them. 175 3.2. Parameter Value Character Set and Language Information 177 Section 4 of [RFC2231] specifies how to embed language information 178 into parameter values, and also how to encode non-ASCII characters, 179 dealing with restrictions both in MIME and HTTP header parameters. 181 However, RFC 2231 does not specify a mandatory-to-implement character 182 set, making it hard for senders to decide which character set to use. 183 Thus, recipients implementing this specification MUST support the 184 character sets "ISO-8859-1" [ISO-8859-1] and "UTF-8" [RFC3629]. 186 Furthermore, RFC 2231 allows leaving out the character set 187 information. The profile defined by this specification does not 188 allow that. 190 The syntax for parameters is defined in Section 3.6 of [RFC2616] 191 (with RFC 2616 implied LWS translated to RFC 5234 LWSP): 193 parameter = attribute LWSP "=" LWSP value 195 attribute = token 196 value = token / quoted-string 198 quoted-string = 199 token = 201 This specification extends the grammar to: 203 parameter = reg-parameter / ext-parameter 205 reg-parameter = attribute LWSP "=" LWSP value 207 ext-parameter = attribute "*" LWSP "=" LWSP ext-value 209 ext-value = charset "'" [ language ] "'" value-chars 210 ; extended-initial-value, 211 ; defined in [RFC2231], Section 7 213 charset = "UTF-8" / "ISO-8859-1" / mime-charset 215 mime-charset = 1*mime-charsetc 216 mime-charsetc = ALPHA / DIGIT 217 / "!" / "#" / "$" / "%" / "&" 218 / "+" / "-" / "^" / "_" / "`" 219 / "{" / "}" / "~" 220 ; as in Section 2.3 of [RFC2978] 221 ; except that the single quote is not included 223 language = 225 value-chars = *( pct-encoded / attr-char ) 227 pct-encoded = "%" HEXDIG HEXDIG 228 ; see [RFC3986], Section 2.1 230 attr-char = ALPHA / DIGIT 231 / "-" / "." / "_" / "~" / ":" 232 / "!" / "$" / "&" / "+" 234 Thus, a parameter is either regular parameter (reg-parameter), as 235 previously defined in Section 3.6 of [RFC2616], or an extended 236 parameter (ext-parameter). 238 Extended parameters are those where the left hand side of the 239 assignment ends with an asterisk character. 241 The value part of an extended parameter (ext-value) is a token that 242 consists of three parts: the REQUIRED character set name (charset), 243 the OPTIONAL language information (language), and a character 244 sequence representing the actual value (value-chars), separated by 245 single quote characters. Note that both character set names and 246 language tags are restricted to the US-ASCII character set, and are 247 matched case-insensitively (see [RFC2978], Section 2.3 and [RFC5646], 248 Section 2.1.1). 250 Inside the value part, characters not contained in attr-char are 251 encoded into an octet sequence using the specified character set. 252 That octet sequence then is percent-encoded as specified in Section 253 2.1 of [RFC3986]. 255 Producers MUST NOT use character sets other than "UTF-8" ([RFC3629]) 256 or "ISO-8859-1" ([ISO-8859-1]). Extension character sets (ext- 257 charset) are reserved for future use. 259 Note: recipients should be prepared to handle encoding errors, 260 such as malformed or incomplete percent escape sequences, or non- 261 decodable octet sequences, in a robust manner. This specification 262 does not mandate any specific behavior, for instance the following 263 strategies are all acceptable: 265 * ignoring the parameter, 267 * stripping a non-decodable octet sequence, 269 * substituting a non-decodable octet sequence by a replacement 270 character, such as the Unicode character U+FFFD (Replacement 271 Character). 273 Note: the ABNF defined here differs from the one in 274 Section 2.3 of [RFC2978] in that it does not allow the single 275 quote character (see also RFC Editor Errata ID 1912 [3]). In 276 practice, no character set names using that character have been 277 registered at the time of this writing. 279 3.2.1. Examples 281 Non-extended notation, using "token": 283 foo: bar; title=Economy 285 Non-extended notation, using "quoted-string": 287 foo: bar; title="US-$ rates" 289 Extended notation, using the unicode character U+00A3 (POUND SIGN): 291 foo: bar; title*=iso-8859-1'en'%A3%20rates 293 Note: the Unicode pound sign character U+00A3 was encoded using ISO- 294 8859-1 into the single octet A3, then percent-encoded. Also note 295 that the space character was encoded as %20, as it is not contained 296 in attr-char. 298 Extended notation, using the unicode characters U+00A3 (POUND SIGN) 299 and U+20AC (EURO SIGN): 301 foo: bar; title*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates 303 Note: the unicode pound sign character U+00A3 was encoded using UTF-8 304 into the octet sequence C2 A3, then percent-encoded. Likewise, the 305 unicode euro sign character U+20AC was encoded into the octet 306 sequence E2 82 AC, then percent-encoded. Also note that HEXDIG 307 allows both lower-case and upper-case character, so recipients must 308 understand both, and that the language information is optional, while 309 the character set is not. 311 3.3. Language specification in Encoded Words 313 Section 5 of [RFC2231] extends the encoding defined in [RFC2047] to 314 also support language specification in encoded words. Although the 315 HTTP/1.1 specification does refer to RFC 2047 ([RFC2616], Section 316 2.2), it's not clear to which header field exactly it applies, and 317 whether it is implemented in practice (see 318 for details). 320 Thus, the RFC 2231 profile defined by this specification does not 321 include this feature. 323 4. Guidelines for Usage in HTTP Header Field Definitions 325 Specifications of HTTP header fields that use the extensions defined 326 in Section 3.2 should clearly state that. A simple way to achieve 327 this is to normatively reference this specification, and to include 328 the ext-value production into the ABNF for that header field. 330 For instance: 332 foo-header = "foo" LWSP ":" LWSP token ";" LWSP title-param 333 title-param = "title" LWSP "=" LWSP value 334 / "title*" LWSP "=" LWSP ext-value 335 ext-value = 337 [[rfcno: Note to RFC Editor: in the figure above, please replace 338 "xxxx" by the RFC number assigned to this specification.]] 340 4.1. When to Use the Extension 342 Section 4.2 of [RFC2277] requires that protocol elements containing 343 text can carry language information. Thus, the ext-value production 344 should always be used when the parameter value is of textual nature. 346 Furthermore, the extension should also be used whenever the parameter 347 value needs to carry characters not present in the US-ASCII 348 ([USASCII]) character set (note that it would be unacceptable to 349 define a new parameter that would be restricted to a subset of the 350 Unicode character set). 352 4.2. Error Handling 354 Header specifications that include parameters should also specify 355 whether same-named parameters can occur multiple times. If 356 repetitions are not allowed (and this is believed to be the common 357 case), the specification should state whether regular or the extended 358 syntax takes precedence. In the latter case, this could be used by 359 producers to use both formats without breaking recipients that do not 360 understand the syntax. 362 Example: 364 foo: bar; title="EURO exchange rates"; 365 title*=utf-8''%e2%82%ac%20exchange%20rates 367 In this case, the sender provides an ASCII version of the title for 368 legacy recipients, but also includes an internationalized version for 369 recipients understanding this specification -- the latter obviously 370 should prefer the new syntax over the old one. 372 Note: at the time of this writing, many implementations failed to 373 ignore the form they do not understand, or prioritize the ASCII 374 form although the extended syntax was present. 376 4.3. Using Multiple Instances for Internationalization 378 It is expected that in many cases, internationalization of parameters 379 in response headers is implemented using server driven content 380 negotiation ([RFC2616], Section 12.1) using the Accept-Language 381 header ([RFC2616], Section 14.4). However, the format described in 382 this specification also allows to use multiple instances providing 383 multiple languages in a single header. Specifications that want to 384 take advantage of this should clearly specify the expected processing 385 by the recipient. 387 Example: 389 foo: bar; title*=utf-8'en'Document%20Title; 390 title*=utf-8'de'Titel%20des%20Dokuments 392 5. Security Considerations 394 This document does not discuss security issues and is not believed to 395 raise any security issues not already endemic in HTTP. 397 6. IANA Considerations 399 There are no IANA Considerations related to this specification. 401 7. Acknowledgements 403 Thanks to Martin Duerst and Frank Ellermann for help figuring out 404 ABNF details, and to Roar Lauritzsen for implementer's feedback. 406 8. References 408 8.1. Normative References 410 [ISO-8859-1] 411 International Organization for Standardization, 412 "Information technology -- 8-bit single-byte coded graphic 413 character sets -- Part 1: Latin alphabet No. 1", ISO/ 414 IEC 8859-1:1998, 1998. 416 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 417 Requirement Levels", BCP 14, RFC 2119, March 1997. 419 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 420 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 421 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 423 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 424 10646", RFC 3629, STD 63, November 2003. 426 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 427 Specifications: ABNF", STD 68, RFC 5234, January 2008. 429 [RFC5646] Phillips, A., Ed. and M. Davis, Ed., "Tags for Identifying 430 Languages", BCP 47, RFC 5646, September 2009. 432 8.2. Informative References 434 [RFC2047] Moore, K., "MIME (Multipurpose Internet Mail Extensions) 435 Part Three: Message Header Extensions for Non-ASCII Text", 436 RFC 2047, November 1996. 438 [RFC2231] Freed, N. and K. Moore, "MIME Parameter Value and Encoded 439 Word Extensions: 440 Character Sets, Languages, and Continuations", RFC 2231, 441 November 1997. 443 [RFC2277] Alvestrand, H., "IETF Policy on Character Sets and 444 Languages", BCP 18, RFC 2277, January 1998. 446 [RFC2388] Masinter, L., "Returning Values from Forms: multipart/ 447 form-data", RFC 2388, August 1998. 449 [RFC2978] Freed, N. and J. Postel, "IANA Charset Registration 450 Procedures", BCP 19, RFC 2978, October 2000. 452 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 453 Resource Identifier (URI): Generic Syntax", RFC 3986, 454 STD 66, January 2005. 456 [USASCII] American National Standards Institute, "Coded Character 457 Set -- 7-bit American Standard Code for Information 458 Interchange", ANSI X3.4, 1986. 460 URIs 462 [1] 464 [2] 466 [3] 468 Appendix A. Document History and Future Plans (to be removed by RFC 469 Editor before publication) 471 Problems with the internationalization of the HTTP Content- 472 Disposition header field have been known for many years (see test 473 cases at ). 475 During IETF 72 476 (), the 477 HTTPbis Working Group shortly discussed how to deal with the 478 underspecification of (1) Content-Disposition, and its (2) 479 internationalization aspects. Back then, there was rough consensus 480 in the room to move the definition into a separate draft. 482 This specification addresses problem (2), by defining a simple subset 483 of the encoding format defined in RFC 2231. A separate 484 specification, draft-reschke-rfc2183-in-http, is planned to address 485 problem (1). Note that this approach was chosen because Content- 486 Disposition is just an example for an HTTP header field using this 487 kind of encoding. Another example is the currently proposed Link 488 header field (draft-nottingham-http-link-header). 490 This document is planned to be published on the IETF Standards Track, 491 so that other standards-track level documents can depend on it, such 492 as the new specification of Content-Disposition, or potentially 493 future revisions of the HTTP Link Header specification. 495 Also note that this document specifies a proper subset of the 496 extensions defined in RFC 2231, but does not normatively refer to it. 497 Thus, RFC 2231 can be revised separately, should the email community 498 decide to. 500 Appendix B. Change Log (to be removed by RFC Editor before publication) 502 B.1. Since draft-reschke-rfc2231-in-http-00 504 Use RFC5234-style ABNF, closer to the one used in RFC 2231. 506 Make RFC 2231 dependency informative, so this specification can 507 evolve independently. 509 Explain the ABNF in prose. 511 B.2. Since draft-reschke-rfc2231-in-http-01 513 Remove unneeded RFC5137 notation (code point vs character). 515 B.3. Since draft-reschke-rfc2231-in-http-02 517 And and resolve issues "charset", "repeats" and "rfc4646". 519 B.4. Since draft-reschke-rfc2231-in-http-03 521 And and resolve issue "charsetmatch". 523 B.5. Since draft-reschke-rfc2231-in-http-04 525 Add and resolve issues "badseq" and "tokenquotcharset". 527 B.6. Since draft-reschke-rfc2231-in-http-05 529 Say "header field" instead of "header" in the context of HTTP. 531 B.7. Since draft-reschke-rfc2231-in-http-06 533 Add an appendix discussing document history and future plans, to be 534 removed before publication. 536 B.8. Since draft-reschke-rfc2231-in-http-07 538 Add and resolve issues "impl" and "rel-2388". 540 Appendix C. Resolved issues (to be removed by RFC Editor before 541 publication) 543 Issues that were either rejected or resolved in this version of this 544 document. 546 C.1. edit 548 Type: edit 550 julian.reschke@greenbytes.de (2009-04-17): Umbrella issue for 551 editorial fixes/enhancements. 553 C.2. impl 555 Type: edit 557 julian.reschke@greenbytes.de (2010-01-16): Report on current 558 implementations. 560 C.3. rel-2388 562 Type: edit 564 julian.reschke@greenbytes.de (2010-01-07): Note the non-applicability 565 to the use of RFC 2231 encoding in multipart/form-data. 567 Resolution (2010-01-07): Done. 569 Author's Address 571 Julian F. Reschke 572 greenbytes GmbH 573 Hafenweg 16 574 Muenster, NW 48155 575 Germany 577 Email: julian.reschke@greenbytes.de 578 URI: http://greenbytes.de/tech/webdav/