idnits 2.17.1 draft-reschke-rfc2231-in-http-06.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 (November 22, 2009) is 5263 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) Summary: 3 errors (**), 0 flaws (~~), 1 warning (==), 3 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 November 22, 2009 5 Expires: May 26, 2010 7 Application of RFC 2231 Encoding to 8 Hypertext Transfer Protocol (HTTP) Header Fields 9 draft-reschke-rfc2231-in-http-06 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. 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 is 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 Status of this Memo 45 This Internet-Draft is submitted to IETF in full conformance with the 46 provisions of BCP 78 and BCP 79. 48 Internet-Drafts are working documents of the Internet Engineering 49 Task Force (IETF), its areas, and its working groups. Note that 50 other groups may also distribute working documents as Internet- 51 Drafts. 53 Internet-Drafts are draft documents valid for a maximum of six months 54 and may be updated, replaced, or obsoleted by other documents at any 55 time. It is inappropriate to use Internet-Drafts as reference 56 material or to cite them other than as "work in progress." 58 The list of current Internet-Drafts can be accessed at 59 http://www.ietf.org/ietf/1id-abstracts.txt. 61 The list of Internet-Draft Shadow Directories can be accessed at 62 http://www.ietf.org/shadow.html. 64 This Internet-Draft will expire on May 26, 2010. 66 Copyright Notice 68 Copyright (c) 2009 IETF Trust and the persons identified as the 69 document authors. All rights reserved. 71 This document is subject to BCP 78 and the IETF Trust's Legal 72 Provisions Relating to IETF Documents 73 (http://trustee.ietf.org/license-info) in effect on the date of 74 publication of this document. Please review these documents 75 carefully, as they describe your rights and restrictions with respect 76 to this document. Code Components extracted from this document must 77 include Simplified BSD License text as described in Section 4.e of 78 the Trust Legal Provisions and are provided without warranty as 79 described in the BSD License. 81 Table of Contents 83 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 84 2. Notational Conventions . . . . . . . . . . . . . . . . . . . . 4 85 3. A Profile of RFC 2231 for Use in HTTP . . . . . . . . . . . . 4 86 3.1. Parameter Continuations . . . . . . . . . . . . . . . . . 4 87 3.2. Parameter Value Character Set and Language Information . . 5 88 3.2.1. Examples . . . . . . . . . . . . . . . . . . . . . . . 7 89 3.3. Language specification in Encoded Words . . . . . . . . . 8 90 4. Guidelines for Usage in HTTP Header Field Definitions . . . . 8 91 4.1. When to Use the Extension . . . . . . . . . . . . . . . . 8 92 4.2. Error Handling . . . . . . . . . . . . . . . . . . . . . . 9 93 4.3. Using Multiple Instances for Internationalization . . . . 9 94 5. Security Considerations . . . . . . . . . . . . . . . . . . . 10 95 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 10 96 7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 10 97 8. References . . . . . . . . . . . . . . . . . . . . . . . . . . 10 98 8.1. Normative References . . . . . . . . . . . . . . . . . . . 10 99 8.2. Informative References . . . . . . . . . . . . . . . . . . 10 100 Appendix A. Change Log (to be removed by RFC Editor before 101 publication) . . . . . . . . . . . . . . . . . . . . 11 102 A.1. Since draft-reschke-rfc2231-in-http-00 . . . . . . . . . . 11 103 A.2. Since draft-reschke-rfc2231-in-http-01 . . . . . . . . . . 11 104 A.3. Since draft-reschke-rfc2231-in-http-02 . . . . . . . . . . 11 105 A.4. Since draft-reschke-rfc2231-in-http-03 . . . . . . . . . . 12 106 A.5. Since draft-reschke-rfc2231-in-http-04 . . . . . . . . . . 12 107 A.6. Since draft-reschke-rfc2231-in-http-05 . . . . . . . . . . 12 108 Appendix B. Open issues (to be removed by RFC Editor prior to 109 publication) . . . . . . . . . . . . . . . . . . . . 12 110 B.1. edit . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 111 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 12 113 1. Introduction 115 By default, message header field parameters in HTTP ([RFC2616]) 116 messages can not carry characters outside the ISO-8859-1 character 117 set ([ISO-8859-1]). RFC 2231 ([RFC2231]) defines an escaping 118 mechanism for use in MIME headers. This document specifies a profile 119 of that encoding for use in HTTP. 121 2. Notational Conventions 123 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 124 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 125 document are to be interpreted as described in [RFC2119]. 127 This specification uses the ABNF (Augmented Backus-Naur Form) 128 notation defined in [RFC5234]. The following core rules are included 129 by reference, as defined in [RFC5234], Appendix B.1: ALPHA (letters), 130 DIGIT (decimal 0-9), HEXDIG (hexadecimal 0-9/A-F/a-f) and LWSP 131 (linear white space). 133 Note that this specification uses the term "character set" for 134 consistency with other IETF specifications such as RFC 2277 (see 135 [RFC2277], Section 3). A more accurate term would be "character 136 encoding" (a mapping of code points to octet sequences). 138 3. A Profile of RFC 2231 for Use in HTTP 140 RFC 2231 defines several extensions to MIME. The sections below 141 discuss if and how they apply to HTTP. 143 In short: 145 o Parameter Continuations aren't needed (Section 3.1), 147 o Character Set and Language Information are useful, therefore a 148 simple subset is specified (Section 3.2), and 150 o Language Specifications in Encoded Words aren't needed 151 (Section 3.3). 153 3.1. Parameter Continuations 155 Section 3 of [RFC2231] defines a mechanism that deals with the length 156 limitations that apply to MIME headers. These limitations do not 157 apply to HTTP ([RFC2616], Section 19.4.7). 159 Thus in HTTP, senders MUST NOT use parameter continuations, and 160 therefore recipients do not need to support them. 162 3.2. Parameter Value Character Set and Language Information 164 Section 4 of [RFC2231] specifies how to embed language information 165 into parameter values, and also how to encode non-ASCII characters, 166 dealing with restrictions both in MIME and HTTP header parameters. 168 However, RFC 2231 does not specify a mandatory-to-implement character 169 set, making it hard for senders to decide which character set to use. 170 Thus, recipients implementing this specification MUST support the 171 character sets "ISO-8859-1" [ISO-8859-1] and "UTF-8" [RFC3629]. 173 Furthermore, RFC 2231 allows leaving out the character set 174 information. The profile defined by this specification does not 175 allow that. 177 The syntax for parameters is defined in Section 3.6 of [RFC2616] 178 (with RFC 2616 implied LWS translated to RFC 5234 LWSP): 180 parameter = attribute LWSP "=" LWSP value 182 attribute = token 183 value = token / quoted-string 185 quoted-string = 186 token = 188 This specification extends the grammar to: 190 parameter = reg-parameter / ext-parameter 192 reg-parameter = attribute LWSP "=" LWSP value 194 ext-parameter = attribute "*" LWSP "=" LWSP ext-value 196 ext-value = charset "'" [ language ] "'" value-chars 197 ; extended-initial-value, 198 ; defined in [RFC2231], Section 7 200 charset = "UTF-8" / "ISO-8859-1" / mime-charset 202 mime-charset = 1*mime-charsetc 203 mime-charsetc = ALPHA / DIGIT 204 / "!" / "#" / "$" / "%" / "&" 205 / "+" / "-" / "^" / "_" / "`" 206 / "{" / "}" / "~" 207 ; as in Section 2.3 of [RFC2978] 208 ; except that the single quote is not included 210 language = 212 value-chars = *( pct-encoded / attr-char ) 214 pct-encoded = "%" HEXDIG HEXDIG 215 ; see [RFC3986], Section 2.1 217 attr-char = ALPHA / DIGIT 218 / "-" / "." / "_" / "~" / ":" 219 / "!" / "$" / "&" / "+" 221 Thus, a parameter is either regular parameter (reg-parameter), as 222 previously defined in Section 3.6 of [RFC2616], or an extended 223 parameter (ext-parameter). 225 Extended parameters are those where the left hand side of the 226 assignment ends with an asterisk character. 228 The value part of an extended parameter (ext-value) is a token that 229 consists of three parts: the REQUIRED character set name (charset), 230 the OPTIONAL language information (language), and a character 231 sequence representing the actual value (value-chars), separated by 232 single quote characters. Note that both character set names and 233 language tags are restricted to the US-ASCII character set, and are 234 matched case-insensitively (see [RFC2978], Section 2.3 and [RFC5646], 235 Section 2.1.1). 237 Inside the value part, characters not contained in attr-char are 238 encoded into an octet sequence using the specified character set. 239 That octet sequence then is percent-encoded as specified in Section 240 2.1 of [RFC3986]. 242 Producers MUST NOT use character sets other than "UTF-8" ([RFC3629]) 243 or "ISO-8859-1" ([ISO-8859-1]). Extension character sets (ext- 244 charset) are reserved for future use. 246 Note: recipients should be prepared to handle encoding errors, 247 such as malformed or incomplete percent escape sequences, or non- 248 decodable octet sequences, in a robust manner. This specification 249 does not mandate any specific behavior, for instance the following 250 strategies are all acceptable: 252 * ignoring the parameter, 254 * stripping a non-decodable octet sequence, 256 * substituting a non-decodable octet sequence by a replacement 257 character, such as the Unicode character U+FFFD (Replacement 258 Character). 260 Note: the ABNF defined here differs from the one in 261 Section 2.3 of [RFC2978] in that it does not allow the single 262 quote character (see also RFC Editor Errata ID 1912 [3]). In 263 practice, no character set names using that character have been 264 registered at the time of this writing. 266 3.2.1. Examples 268 Non-extended notation, using "token": 270 foo: bar; title=Economy 272 Non-extended notation, using "quoted-string": 274 foo: bar; title="US-$ rates" 276 Extended notation, using the unicode character U+00A3 (POUND SIGN): 278 foo: bar; title*=iso-8859-1'en'%A3%20rates 280 Note: the Unicode pound sign character U+00A3 was encoded using ISO- 281 8859-1 into the single octet A3, then percent-encoded. Also note 282 that the space character was encoded as %20, as it is not contained 283 in attr-char. 285 Extended notation, using the unicode characters U+00A3 (POUND SIGN) 286 and U+20AC (EURO SIGN): 288 foo: bar; title*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates 290 Note: the unicode pound sign character U+00A3 was encoded using UTF-8 291 into the octet sequence C2 A3, then percent-encoded. Likewise, the 292 unicode euro sign character U+20AC was encoded into the octet 293 sequence E2 82 AC, then percent-encoded. Also note that HEXDIG 294 allows both lower-case and upper-case character, so recipients must 295 understand both, and that the language information is optional, while 296 the character set is not. 298 3.3. Language specification in Encoded Words 300 Section 5 of [RFC2231] extends the encoding defined in [RFC2047] to 301 also support language specification in encoded words. Although the 302 HTTP/1.1 specification does refer to RFC 2047 ([RFC2616], Section 303 2.2), it's not clear to which header field exactly it applies, and 304 whether it is implemented in practice (see 305 for details). 307 Thus, the RFC 2231 profile defined by this specification does not 308 include this feature. 310 4. Guidelines for Usage in HTTP Header Field Definitions 312 Specifications of HTTP header fields that use the extensions defined 313 in Section 3.2 should clearly state that. A simple way to achieve 314 this is to normatively reference this specification, and to include 315 the ext-value production into the ABNF for that header field. 317 For instance: 319 foo-header = "foo" LWSP ":" LWSP token ";" LWSP title-param 320 title-param = "title" LWSP "=" LWSP value 321 / "title*" LWSP "=" LWSP ext-value 322 ext-value = 324 [[rfcno: Note to RFC Editor: in the figure above, please replace 325 "xxxx" by the RFC number assigned to this specification.]] 327 4.1. When to Use the Extension 329 Section 4.2 of [RFC2277] requires that protocol elements containing 330 text can carry language information. Thus, the ext-value production 331 should always be used when the parameter value is of textual nature. 333 Furthermore, the extension should also be used whenever the parameter 334 value needs to carry characters not present in the US-ASCII 335 ([USASCII]) character set (note that it would be unacceptable to 336 define a new parameter that would be restricted to a subset of the 337 Unicode character set). 339 4.2. Error Handling 341 Header specifications that include parameters should also specify 342 whether same-named parameters can occur multiple times. If 343 repetitions are not allowed (and this is believed to be the common 344 case), the specification should state whether regular or the extended 345 syntax takes precedence. In the latter case, this could be used by 346 producers to use both formats without breaking recipients that do not 347 understand the syntax. 349 Example: 351 foo: bar; title="EURO exchange rates"; 352 title*=utf-8''%e2%82%ac%20exchange%20rates 354 In this case, the sender provides an ASCII version of the title for 355 legacy recipients, but also includes an internationalized version for 356 recipients understanding this specification -- the latter obviously 357 should prefer the new syntax over the old one. 359 Note: at the time of this writing, many implementations failed to 360 ignore the form they do not understand, or prioritize the ASCII 361 form although the extended syntax was present. 363 4.3. Using Multiple Instances for Internationalization 365 It is expected that in many cases, internationalization of parameters 366 in response headers is implemented using server driven content 367 negotiation ([RFC2616], Section 12.1) using the Accept-Language 368 header ([RFC2616], Section 14.4). However, the format described in 369 this specification also allows to use multiple instances providing 370 multiple languages in a single header. Specifications that want to 371 take advantage of this should clearly specify the expected processing 372 by the recipient. 374 Example: 376 foo: bar; title*=utf-8'en'Document%20Title; 377 title*=utf-8'de'Titel%20des%20Dokuments 379 5. Security Considerations 381 This document does not discuss security issues and is not believed to 382 raise any security issues not already endemic in HTTP. 384 6. IANA Considerations 386 There are no IANA Considerations related to this specification. 388 7. Acknowledgements 390 Thanks to Martin Duerst and Frank Ellermann for help figuring out 391 ABNF details, and to Roar Lauritzsen for implementer's feedback. 393 8. References 395 8.1. Normative References 397 [ISO-8859-1] 398 International Organization for Standardization, 399 "Information technology -- 8-bit single-byte coded graphic 400 character sets -- Part 1: Latin alphabet No. 1", ISO/ 401 IEC 8859-1:1998, 1998. 403 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 404 Requirement Levels", BCP 14, RFC 2119, March 1997. 406 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 407 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 408 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 410 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 411 10646", RFC 3629, STD 63, November 2003. 413 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 414 Specifications: ABNF", STD 68, RFC 5234, January 2008. 416 [RFC5646] Phillips, A., Ed. and M. Davis, Ed., "Tags for Identifying 417 Languages", BCP 47, RFC 5646, September 2009. 419 8.2. Informative References 421 [RFC2047] Moore, K., "MIME (Multipurpose Internet Mail Extensions) 422 Part Three: Message Header Extensions for Non-ASCII Text", 423 RFC 2047, November 1996. 425 [RFC2231] Freed, N. and K. Moore, "MIME Parameter Value and Encoded 426 Word Extensions: 427 Character Sets, Languages, and Continuations", RFC 2231, 428 November 1997. 430 [RFC2277] Alvestrand, H., "IETF Policy on Character Sets and 431 Languages", BCP 18, RFC 2277, January 1998. 433 [RFC2978] Freed, N. and J. Postel, "IANA Charset Registration 434 Procedures", BCP 19, RFC 2978, October 2000. 436 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 437 Resource Identifier (URI): Generic Syntax", RFC 3986, 438 STD 66, January 2005. 440 [USASCII] American National Standards Institute, "Coded Character 441 Set -- 7-bit American Standard Code for Information 442 Interchange", ANSI X3.4, 1986. 444 URIs 446 [1] 448 [2] 450 [3] 452 Appendix A. Change Log (to be removed by RFC Editor before publication) 454 A.1. Since draft-reschke-rfc2231-in-http-00 456 Use RFC5234-style ABNF, closer to the one used in RFC 2231. 458 Make RFC 2231 dependency informative, so this specification can 459 evolve independently. 461 Explain the ABNF in prose. 463 A.2. Since draft-reschke-rfc2231-in-http-01 465 Remove unneeded RFC5137 notation (code point vs character). 467 A.3. Since draft-reschke-rfc2231-in-http-02 469 And and resolve issues "charset", "repeats" and "rfc4646". 471 A.4. Since draft-reschke-rfc2231-in-http-03 473 And and resolve issue "charsetmatch". 475 A.5. Since draft-reschke-rfc2231-in-http-04 477 Add and resolve issues "badseq" and "tokenquotcharset". 479 A.6. Since draft-reschke-rfc2231-in-http-05 481 Say "header field" instead of "header" in the context of HTTP. 483 Appendix B. Open issues (to be removed by RFC Editor prior to 484 publication) 486 B.1. edit 488 Type: edit 490 julian.reschke@greenbytes.de (2009-04-17): Umbrella issue for 491 editorial fixes/enhancements. 493 Author's Address 495 Julian F. Reschke 496 greenbytes GmbH 497 Hafenweg 16 498 Muenster, NW 48155 499 Germany 501 Email: julian.reschke@greenbytes.de 502 URI: http://greenbytes.de/tech/webdav/