idnits 2.17.1 draft-reschke-rfc2231-in-http-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. 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 (December 30, 2008) is 5596 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) == Unused Reference: 'RFC4646' is defined on line 358, but no explicit reference was found in the text -- 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 normative reference: RFC 4646 (Obsoleted by RFC 5646) Summary: 3 errors (**), 0 flaws (~~), 2 warnings (==), 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 December 30, 2008 5 Expires: July 3, 2009 7 Application of RFC 2231 Encoding to 8 Hypertext Transfer Protocol (HTTP) Headers 9 draft-reschke-rfc2231-in-http-01 11 Status of this Memo 13 This Internet-Draft is submitted to IETF in full conformance with the 14 provisions of BCP 78 and BCP 79. 16 Internet-Drafts are working documents of the Internet Engineering 17 Task Force (IETF), its areas, and its working groups. Note that 18 other groups may also distribute working documents as Internet- 19 Drafts. 21 Internet-Drafts are draft documents valid for a maximum of six months 22 and may be updated, replaced, or obsoleted by other documents at any 23 time. It is inappropriate to use Internet-Drafts as reference 24 material or to cite them other than as "work in progress." 26 The list of current Internet-Drafts can be accessed at 27 http://www.ietf.org/ietf/1id-abstracts.txt. 29 The list of Internet-Draft Shadow Directories can be accessed at 30 http://www.ietf.org/shadow.html. 32 This Internet-Draft will expire on July 3, 2009. 34 Copyright Notice 36 Copyright (c) 2008 IETF Trust and the persons identified as the 37 document authors. All rights reserved. 39 This document is subject to BCP 78 and the IETF Trust's Legal 40 Provisions Relating to IETF Documents 41 (http://trustee.ietf.org/license-info) in effect on the date of 42 publication of this document. Please review these documents 43 carefully, as they describe your rights and restrictions with respect 44 to this document. 46 Abstract 48 By default, message header parameters in Hypertext Transfer Protocol 49 (HTTP) messages can not carry characters outside the ISO-8859-1 50 character set. RFC 2231 defines an escaping mechanism for use in 51 Multipurpose Internet Mail Extensions (MIME) headers. This document 52 specifies a profile of that encoding suitable for use in HTTP. 54 Editorial Note (To be removed by RFC Editor before publication) 56 There are multiple HTTP headers that already use RFC 2231 encoding in 57 practice (Content-Disposition) or might use it in the future (Link). 58 The purpose of this document is to provide a single place where the 59 generic aspects of RFC 2231 encoding in HTTP headers are defined. 61 Distribution of this document is unlimited. Although this is not a 62 work item of the HTTPbis Working Group, comments should be sent to 63 the Hypertext Transfer Protocol (HTTP) mailing list at 64 ietf-http-wg@w3.org [1], which may be joined by sending a message 65 with subject "subscribe" to ietf-http-wg-request@w3.org [2]. 67 Discussions of the HTTPbis Working Group are archived at 68 . 70 XML versions, latest edits and the issues list for this document are 71 available from 72 . A 73 collection of test cases is available at 74 . 76 Table of Contents 78 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 79 2. Notational Conventions . . . . . . . . . . . . . . . . . . . . 4 80 3. A Profile of RFC 2231 for Use in HTTP . . . . . . . . . . . . 4 81 3.1. Parameter Continuations . . . . . . . . . . . . . . . . . 5 82 3.2. Parameter Value Character Set and Language Information . . 5 83 3.2.1. Examples . . . . . . . . . . . . . . . . . . . . . . . 7 84 3.3. Language specification in Encoded Words . . . . . . . . . 7 85 4. Guidelines for Usage in HTTP Header Definitions . . . . . . . 8 86 4.1. When to Use the Extension . . . . . . . . . . . . . . . . 8 87 4.2. Error Handling . . . . . . . . . . . . . . . . . . . . . . 8 88 5. Security Considerations . . . . . . . . . . . . . . . . . . . 9 89 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9 90 7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 9 91 8. References . . . . . . . . . . . . . . . . . . . . . . . . . . 9 92 8.1. Normative References . . . . . . . . . . . . . . . . . . . 9 93 8.2. Informative References . . . . . . . . . . . . . . . . . . 10 94 Appendix A. Change Log (to be removed by RFC Editor before 95 publication) . . . . . . . . . . . . . . . . . . . . 10 96 A.1. Since draft-reschke-rfc2231-in-http-00 . . . . . . . . . . 10 97 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 10 99 1. Introduction 101 By default, message header parameters in HTTP ([RFC2616]) messages 102 can not carry characters outside the ISO-8859-1 character set 103 ([ISO-8859-1]). RFC 2231 ([RFC2231]) defines an escaping mechanism 104 for use in MIME headers. This document specifies a profile of that 105 encoding for use in HTTP. 107 2. Notational Conventions 109 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 110 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 111 document are to be interpreted as described in [RFC2119]. 113 This specification uses the ABNF (Augmented Backus-Naur Form) 114 notation defined in [RFC5234]. The following core rules are included 115 by reference, as defined in [RFC5234], Appendix B.1: ALPHA (letters), 116 DIGIT (decimal 0-9), HEXDIG (hexadecimal 0-9/A-F/a-f) and LWSP 117 (linear white space). 119 Non-ASCII characters used in prose for examples are encoded using the 120 format "Backslash-U with Delimiters", defined in Section 5.1 of 121 [RFC5137]. 123 Note that this specification uses the term "character set" for 124 consistency with other IETF specifications such as RFC 2277 (see 125 [RFC2277], Section 3). A more accurate term would be "character 126 encoding" (a mapping of code points to octet sequences). 128 3. A Profile of RFC 2231 for Use in HTTP 130 RFC 2231 defines several extensions to MIME. The sections below 131 discuss if and how they apply to HTTP. 133 In short: 135 o Parameter Continuations aren't needed (Section 3.1), 137 o Character Set and Language Information are useful, therefore a 138 simple subset is specified (Section 3.2), and 140 o Language Specifications in Encoded Words aren't needed 141 (Section 3.3). 143 3.1. Parameter Continuations 145 Section 3 of [RFC2231] defines a mechanism that deals with the length 146 limitations that apply to MIME headers. These limitations do not 147 apply to HTTP ([RFC2616], Section 19.4.7). 149 Thus in HTTP, senders MUST NOT use parameter continuations, and 150 therefore recipients do not need to support them. 152 3.2. Parameter Value Character Set and Language Information 154 Section 4 of [RFC2231] specifies how to embed language information 155 into parameter values, and also how to encode non-ASCII characters, 156 dealing with restrictions both in MIME and HTTP header parameters. 158 However, RFC 2231 does not specify a mandatory-to-implement character 159 encoding, making it hard for senders to decide which character set to 160 use. Thus, recipients implementing this specification MUST support 161 the character sets "ISO-8859-1" [ISO-8859-1] and "UTF-8" [RFC3629]. 163 Furthermore, RFC 2231 allows leaving out the character encoding 164 information. The profile defined by this specification does not 165 allow that. 167 The syntax for parameters is defined in Section 3.6 of [RFC2616] 168 (with RFC 2616 implied LWS translated to RFC 5234 LWSP): 170 parameter = attribute LWSP "=" LWSP value 172 attribute = token 173 value = token / quoted-string 175 quoted-string = 176 token = 178 This specification extends the grammar to: 180 parameter = reg-parameter / ext-parameter 182 reg-parameter = attribute LWSP "=" LWSP value 184 ext-parameter = attribute "*" LWSP "=" LWSP ext-value 186 ext-value = charset "'" [ language ] "'" value-chars 187 ; extended-initial-value, 188 ; defined in [RFC2231], Section 7 190 charset = %x55.54.46.2D.38 ; "UTF-8" 191 / %x49.53.4F.2D.38.38.35.39.2D.31 ; "ISO-8859-1" 192 / ext-charset 194 ext-charset = token ; see IANA charset registry 195 ; () 197 language = 199 value-chars = *( pct-encoded / attr-char ) 201 pct-encoded = "%" HEXDIG HEXDIG 202 ; see [RFC3986], Section 2.1 204 attr-char = ALPHA / DIGIT 205 / "-" / "." / "_" / "~" / ":" 206 / "!" / "$" / "&" / "+" 208 Thus, a parameter is either regular parameter (reg-parameter), as 209 previously defined in Section 3.6 of [RFC2616], or an extended 210 parameter (ext-parameter). 212 Extended parameters are those where the left hand side of the 213 assignment ends with an asterisk character. 215 The value part of an extended parameter (ext-value) is a token that 216 consists of three parts: the REQUIRED character set name (charset), 217 the OPTIONAL language information (language), and a a character 218 sequence representing the actual value (value-chars), separated by 219 single quote characters. 221 Inside the value part, characters not contained in attr-char are 222 encoded into an octet sequence using the specified character set. 223 That octet sequence then is percent-encoded as specified in Section 224 2.1 of [RFC3986]. 226 Producers MUST NOT use character sets other than "UTF-8" ([RFC3629]) 227 or ISO-8859-1 ([ISO-8859-1]). Extension character sets (ext-charset) 228 are reserved for future use. 230 3.2.1. Examples 232 Non-extended notation, using "token": 234 foo: bar; title=Economy 236 Non-extended notation, using "quoted-string": 238 foo: bar; title="US-$ rates" 240 Extended notation, using the unicode character \u'00A3' (POUND SIGN): 242 foo: bar; title*=iso-8859-1'en'%A3%20rates 244 Note: the Unicode pound sign character \u'00A3' was encoded using 245 ISO-8859-1 into the single octet A3, then percent-encoded. Also note 246 that the space character was encoded as %20, as it is not contained 247 in attr-char. 249 Extended notation, using the unicode characters \u'00A3' (POUND SIGN) 250 and \u'20AC' (EURO SIGN): 252 foo: bar; title*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates 254 Note: the unicode pound sign character \u'00A3' was encoded using 255 UTF-8 into the octet sequence C2 A3, then percent-encoded. Likewise, 256 the unicode euro sign character \u'20AC' was encoded into the octet 257 sequence E2 82 AC, then percent-encoded. Also note that HEXDIG 258 allows both lower-case and upper-case character, so recipients must 259 understand both, and that the language information is optional, while 260 the character set is not. 262 3.3. Language specification in Encoded Words 264 Section 5 of [RFC2231] extends the encoding defined in [RFC2047] to 265 also support language specification in encoded words. Although the 266 HTTP/1.1 specification does refer to RFC 2047 ([RFC2616], Section 267 2.2), it's not clear to which header field exactly it applies, and 268 whether it is implemented in practice (see 269 for details). 271 Thus, the RFC 2231 profile defined by this specification does not 272 include this feature. 274 4. Guidelines for Usage in HTTP Header Definitions 276 Specifications of HTTP headers that use the extensions defined in 277 Section 3.2 should clearly state that. A simple way to achieve this 278 is to normatively reference this specification, and to include the 279 ext-value production into the ABNF for that header. 281 For instance: 283 foo-header = "foo" LWSP ":" LWSP token ";" LWSP title-param 284 title-param = "title" LWSP "=" LWSP value 285 / "title*" LWSP "=" LWSP ext-value 286 ext-value = 288 [[rfcno: Note to RFC Editor: in the figure above, please replace 289 "xxxx" by the RFC number assigned to this specification.]] 291 4.1. When to Use the Extension 293 Section 4.2 of [RFC2277] requires that protocol elements containing 294 text can carry language information. Thus, the ext-value production 295 should always be used when the parameter value is of textual nature. 297 Furthermore, the extension should also be used whenever the parameter 298 value needs to carry characters not present in the US-ASCII 299 ([USASCII]) character set (note that it would be unacceptable to 300 define a new parameter that would be restricted to a subset of the 301 Unicode character set). 303 4.2. Error Handling 305 Header specifications that include parameters should also specify 306 whether same-named parameters can occur multiple times. If 307 repetitions are not allowed (and this is believed to be the common 308 case), the specification should state whether regular or the extended 309 syntax takes precedence. In the latter case, this could be used by 310 producers to use both formats without breaking recipients that do not 311 understand the syntax. [[anchor7: Does not work as expected, see 312 and 313 .]] 315 Example: 317 foo: bar; title="EURO exchange rates"; 318 title*=utf-8''%e2%82%ac%20exchange%20rates 320 In this case, the sender provides an ASCII version of the title for 321 legacy recipients, but also includes an internationalized version for 322 recipients understanding this specification -- the latter obviously 323 should prefer the new syntax over the old one. 325 5. Security Considerations 327 This document does not discuss security issues and is not believed to 328 raise any security issues not already endemic in HTTP. 330 6. IANA Considerations 332 There are no IANA Considerations related to this specification. 334 7. Acknowledgements 336 Thanks to Frank Ellermann for help figuring out ABNF details. 338 8. References 340 8.1. Normative References 342 [ISO-8859-1] 343 International Organization for Standardization, 344 "Information technology -- 8-bit single-byte coded graphic 345 character sets -- Part 1: Latin alphabet No. 1", ISO/ 346 IEC 8859-1:1998, 1998. 348 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 349 Requirement Levels", BCP 14, RFC 2119, March 1997. 351 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 352 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 353 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 355 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 356 10646", RFC 3629, STD 63, November 2003. 358 [RFC4646] Phillips, A. and M. Davis, "Tags for Identifying 359 Languages", BCP 47, RFC 4646, September 2006. 361 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 362 Specifications: ABNF", STD 68, RFC 5234, January 2008. 364 8.2. Informative References 366 [RFC2047] Moore, K., "MIME (Multipurpose Internet Mail Extensions) 367 Part Three: Message Header Extensions for Non-ASCII Text", 368 RFC 2047, November 1996. 370 [RFC2231] Freed, N. and K. Moore, "MIME Parameter Value and Encoded 371 Word Extensions: 372 Character Sets, Languages, and Continuations", RFC 2231, 373 November 1997. 375 [RFC2277] Alvestrand, H., "IETF Policy on Character Sets and 376 Languages", BCP 18, RFC 2277, January 1998. 378 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 379 Resource Identifier (URI): Generic Syntax", RFC 3986, 380 STD 66, January 2005. 382 [RFC5137] Klensin, J., "ASCII Escaping of Unicode Characters", 383 BCP 137, RFC 5137, February 2008. 385 [USASCII] American National Standards Institute, "Coded Character 386 Set -- 7-bit American Standard Code for Information 387 Interchange", ANSI X3.4, 1986. 389 URIs 391 [1] 393 [2] 395 Appendix A. Change Log (to be removed by RFC Editor before publication) 397 A.1. Since draft-reschke-rfc2231-in-http-00 399 Use RFC5234-style ABNF, closer to the one used in RFC 2231. 401 Make RFC 2231 dependency informative, so this specification can 402 evolve independantly. 404 Explain the ABNF in prose. 406 Author's Address 408 Julian F. Reschke 409 greenbytes GmbH 410 Hafenweg 16 411 Muenster, NW 48155 412 Germany 414 Email: julian.reschke@greenbytes.de 415 URI: http://greenbytes.de/tech/webdav/