idnits 2.17.1 draft-ietf-httpbis-content-disp-02.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 draft header indicates that this document updates RFC2616, but the abstract doesn't seem to mention this, which it should. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year (Using the creation date from RFC2616, updated by this document, for RFC5378 checks: 1997-10-16) -- 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 (September 22, 2010) is 4958 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 normative reference: RFC 5987 (Obsoleted by RFC 8187) Summary: 2 errors (**), 0 flaws (~~), 1 warning (==), 4 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 HTTPbis Working Group J. Reschke 3 Internet-Draft greenbytes 4 Updates: 2616 (if approved) September 22, 2010 5 Intended status: Standards Track 6 Expires: March 26, 2011 8 Use of the Content-Disposition Header Field in the 9 Hypertext Transfer Protocol (HTTP) 10 draft-ietf-httpbis-content-disp-02 12 Abstract 14 HTTP/1.1 defines the Content-Disposition response header field, but 15 points out that it is not part of the HTTP/1.1 Standard. This 16 specification takes over the definition and registration of Content- 17 Disposition, as used in HTTP, and clarifies internationalization 18 aspects. 20 Editorial Note (To be removed by RFC Editor before publication) 22 This specification is expected to replace the definition of Content- 23 Disposition in the HTTP/1.1 specification, as currently revised by 24 the IETF HTTPbis working group. See also 25 . 27 Discussion of this draft should take place on the HTTPBIS working 28 group mailing list (ietf-http-wg@w3.org). The current issues list is 29 at and related documents (including fancy 31 diffs) can be found at . 33 The changes in this draft are summarized in Appendix D.6. 35 Status of This Memo 37 This Internet-Draft is submitted in full conformance with the 38 provisions of BCP 78 and BCP 79. 40 Internet-Drafts are working documents of the Internet Engineering 41 Task Force (IETF). Note that other groups may also distribute 42 working documents as Internet-Drafts. The list of current Internet- 43 Drafts is at http://datatracker.ietf.org/drafts/current/. 45 Internet-Drafts are draft documents valid for a maximum of six months 46 and may be updated, replaced, or obsoleted by other documents at any 47 time. It is inappropriate to use Internet-Drafts as reference 48 material or to cite them other than as "work in progress." 49 This Internet-Draft will expire on March 26, 2011. 51 Copyright Notice 53 Copyright (c) 2010 IETF Trust and the persons identified as the 54 document authors. All rights reserved. 56 This document is subject to BCP 78 and the IETF Trust's Legal 57 Provisions Relating to IETF Documents 58 (http://trustee.ietf.org/license-info) in effect on the date of 59 publication of this document. Please review these documents 60 carefully, as they describe your rights and restrictions with respect 61 to this document. Code Components extracted from this document must 62 include Simplified BSD License text as described in Section 4.e of 63 the Trust Legal Provisions and are provided without warranty as 64 described in the Simplified BSD License. 66 Table of Contents 68 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 69 2. Notational Conventions . . . . . . . . . . . . . . . . . . . . 4 70 3. Header Field Definition . . . . . . . . . . . . . . . . . . . 4 71 3.1. Grammar . . . . . . . . . . . . . . . . . . . . . . . . . 5 72 3.2. Disposition Type . . . . . . . . . . . . . . . . . . . . . 5 73 3.3. Disposition Parameter: 'Filename' . . . . . . . . . . . . 5 74 3.4. Disposition Parameter: Extensions . . . . . . . . . . . . 6 75 3.5. Extensibility . . . . . . . . . . . . . . . . . . . . . . 6 76 4. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 77 5. Internationalization Considerations . . . . . . . . . . . . . 8 78 6. Security Considerations . . . . . . . . . . . . . . . . . . . 8 79 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 8 80 7.1. Registry for Disposition Values and Parameter . . . . . . 8 81 7.2. Header Field Registration . . . . . . . . . . . . . . . . 8 82 8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 8 83 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 9 84 9.1. Normative References . . . . . . . . . . . . . . . . . . . 9 85 9.2. Informative References . . . . . . . . . . . . . . . . . . 9 86 Appendix A. Changes from the RFC 2616 Definition . . . . . . . . 10 87 Appendix B. Differences compared to RFC 2183 . . . . . . . . . . 10 88 Appendix C. Alternative Approaches to Internationalization . . . 10 89 C.1. RFC 2047 Encoding . . . . . . . . . . . . . . . . . . . . 11 90 C.2. Percent Encoding . . . . . . . . . . . . . . . . . . . . . 11 91 C.3. Encoding Sniffing . . . . . . . . . . . . . . . . . . . . 11 92 C.4. Implementations (to be removed by RFC Editor before 93 publication) . . . . . . . . . . . . . . . . . . . . . . . 11 94 Appendix D. Change Log (to be removed by RFC Editor before 95 publication) . . . . . . . . . . . . . . . . . . . . 12 96 D.1. Since draft-reschke-rfc2183-in-http-00 . . . . . . . . . . 12 97 D.2. Since draft-reschke-rfc2183-in-http-01 . . . . . . . . . . 12 98 D.3. Since draft-reschke-rfc2183-in-http-02 . . . . . . . . . . 12 99 D.4. Since draft-reschke-rfc2183-in-http-03 . . . . . . . . . . 12 100 D.5. Since draft-ietf-httpbis-content-disp-00 . . . . . . . . . 12 101 D.6. Since draft-ietf-httpbis-content-disp-01 . . . . . . . . . 13 102 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 104 1. Introduction 106 HTTP/1.1 defines the Content-Disposition response header field in 107 Section 19.5.1 of [RFC2616], but points out that it is not part of 108 the HTTP/1.1 Standard (Section 15.5): 110 Content-Disposition is not part of the HTTP standard, but since it 111 is widely implemented, we are documenting its use and risks for 112 implementers. 114 This specification takes over the definition and registration of 115 Content-Disposition, as used in HTTP. Based on interoperability 116 testing with existing User Agents, it fully defines a profile of the 117 features defined in the Multipurpose Internet Mail Extensions (MIME) 118 variant ([RFC2183]) of the header field, and also clarifies 119 internationalization aspects. 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 augmented BNF notation defined in Section 128 2.1 of [RFC2616], including its rules for linear whitespace (LWS). 130 3. Header Field Definition 132 The Content-Disposition response header field is used to convey 133 additional information about how to process the response payload, and 134 also can be used to attach additional metadata, such as the filename 135 to use when saving the response payload locally. 137 3.1. Grammar 139 content-disposition = "Content-Disposition" ":" 140 disposition-type *( ";" disposition-parm ) 142 disposition-type = "inline" | "attachment" | disp-ext-type 143 ; case-insensitive 144 disp-ext-type = token 146 disposition-parm = filename-parm | disp-ext-parm 148 filename-parm = "filename" "=" value 149 | "filename*" "=" ext-value 151 disp-ext-parm = token "=" value 152 | ext-token "=" ext-value 153 ext-token = 155 Defined in [RFC2616]: 157 token = 158 value = 160 Defined in [RFC5987]: 162 ext-value = 164 3.2. Disposition Type 166 If the disposition type matches "attachment" (case-insensitively), 167 this indicates that the user agent should prompt the user to save the 168 response locally, rather than process it normally (as per its media 169 type). 171 On the other hand, if it matches "inline" (case-insensitively), this 172 implies default processing. 174 Unknown or unhandled disposition types SHOULD be handled the same way 175 as "attachment" (see also [RFC2183], Section 2.8). 177 3.3. Disposition Parameter: 'Filename' 179 The parameters "filename" and "filename*", to be matched case- 180 insensitively, provide information on how to construct a filename for 181 storing the message payload. 183 Depending on the disposition type, this information might be used 184 right away (in the "save as..." interaction caused for the 185 "attachment" disposition type), or later on (for instance, when the 186 user decides to save the contents of the current page being 187 displayed). 189 The parameters "filename" and "filename*" differ only in that 190 "filename*" uses the encoding defined in [RFC5987], allowing the use 191 of characters not present in the ISO-8859-1 character set 192 ([ISO-8859-1]). 194 Many user agent implementations predating this specification do not 195 understand the "filename*" parameter. Therefore, when both 196 "filename" and "filename*" are present in a single header field 197 value, recipients SHOULD pick "filename*" and ignore "filename". 198 This way, senders can avoid special-casing specific user agents by 199 sending both the more expressive "filename*" parameter, and the 200 "filename" parameter as fallback for legacy recipients (see Section 4 201 for an example). 203 It is essential that user agents treat the specified filename as 204 advisory only, thus be very careful in extracting the desired 205 information. In particular: 207 o When the value contains path separator characters, all but the 208 last segment SHOULD be ignored. This prevents unintentional 209 overwriting of well-known file system location (such as "/etc/ 210 passwd"). 212 o Many platforms do not use Internet Media Types ([RFC2046]) to hold 213 type information in the file system, but rely on filename 214 extensions instead. Trusting the server-provided file extension 215 could introduce a privilege escalation when the saved file is 216 later opened (consider ".exe"). Thus, recipients need to ensure 217 that a file extension is used that is safe, optimally matching the 218 media type of the received payload. 220 o Other aspects recipients need to be aware of are names that have a 221 special meaning in the file system or in shell commands, such as 222 "." and "..", "~", "|", and also device names. 224 3.4. Disposition Parameter: Extensions 226 To enable future extensions, unknown parameters SHOULD be ignored 227 (see also [RFC2183], Section 2.8). 229 3.5. Extensibility 231 Note that Section 9 of [RFC2183] defines IANA registries both for 232 disposition types and disposition parameters. This registry is 233 shared by different protocols using Content-Disposition, such as MIME 234 and HTTP. Therefore, not all registered values may make sense in the 235 context of HTTP. 237 4. Examples 239 Direct UA to show "save as" dialog, with a filename of 240 "example.html": 242 Content-Disposition: Attachment; filename=example.html 244 Direct UA to behave as if the Content-Disposition header field wasn't 245 present, but to remember the filename "example.html" for a subsequent 246 save operation: 248 Content-Disposition: INLINE; FILENAME= "example.html" 250 Direct UA to show "save as" dialog, with a filename of "an example": 252 Content-Disposition: Attachment; Filename*=UTF-8'en'an%20example 254 Note that this example uses the extended encoding defined in 255 [RFC5987] to specify that the natural language of the filename is 256 English, and also to encode the space character which is not allowed 257 in the token production. 259 Direct UA to show "save as" dialog, with a filename containing the 260 Unicode character U+20AC (EURO SIGN): 262 Content-Disposition: attachment; 263 filename*= UTF-8''%e2%82%ac%20rates 265 Here, the encoding defined in [RFC5987] is also used to encode the 266 non-ISO-8859-1 character. 268 Same as above, but adding the "filename" parameter for compatibility 269 with user agents not implementing RFC 5987: 271 Content-Disposition: attachment; 272 filename="EURO rates"; 273 filename*=utf-8''%e2%82%ac%20rates 275 Note: as of September 2010, those user agents that do not support the 276 RFC 5987 encoding ignore "filename*" when it occurs after "filename". 277 Unfortunately, some user agents that do support RFC 5987 do pick the 278 "filename" rather than the "filename*" parameter when it occurs 279 first; it is expected that this situation is going to improve soon. 281 5. Internationalization Considerations 283 The "filename*" parameter (Section 3.3), using the encoding defined 284 in [RFC5987], allows the server to transmit characters outside the 285 ISO-8859-1 character set, and also to optionally specify the language 286 in use. 288 Future parameters might also require internationalization, in which 289 case the same encoding can be used. 291 6. Security Considerations 293 Using server-supplied information for constructing local filenames 294 introduces many risks. These are summarized in Section 3.3. 296 Furthermore, implementers also ought to be aware of the Security 297 Considerations applying to HTTP (see Section 15 of [RFC2616]), and 298 also the parameter encoding defined in [RFC5987] (see Section 5). 300 7. IANA Considerations 302 7.1. Registry for Disposition Values and Parameter 304 This specification does not introduce any changes to the registration 305 procedures for disposition values and parameters that are defined in 306 Section 9 of [RFC2183]. 308 7.2. Header Field Registration 310 This document updates the definition of the Content-Disposition HTTP 311 header field in the permanent HTTP header field registry (see 312 [RFC3864]). 314 Header field name: Content-Disposition 316 Applicable protocol: http 318 Status: standard 320 Author/Change controller: IETF 322 Specification document: this specification (Section 3) 324 8. Acknowledgements 326 Thanks to Rolf Eike Beer, Bjoern Hoehrmann, Alfred Hoenes, Roar 327 Lauritzsen, Henrik Nordstrom, and Mark Nottingham for their valuable 328 feedback. 330 9. References 332 9.1. Normative References 334 [ISO-8859-1] International Organization for Standardization, 335 "Information technology -- 8-bit single-byte coded 336 graphic character sets -- Part 1: Latin alphabet No. 337 1", ISO/IEC 8859-1:1998, 1998. 339 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 340 Requirement Levels", BCP 14, RFC 2119, March 1997. 342 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 343 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 344 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 346 [RFC5987] Reschke, J., "Character Set and Language Encoding for 347 Hypertext Transfer Protocol (HTTP) Header Field 348 Parameters", RFC 5987, August 2010. 350 9.2. Informative References 352 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet 353 Mail Extensions (MIME) Part Two: Media Types", 354 RFC 2046, November 1996. 356 [RFC2047] Moore, K., "MIME (Multipurpose Internet Mail 357 Extensions) Part Three: Message Header Extensions for 358 Non-ASCII Text", RFC 2047, November 1996. 360 [RFC2183] Troost, R., Dorner, S., and K. Moore, "Communicating 361 Presentation Information in Internet Messages: The 362 Content-Disposition Header Field", RFC 2183, 363 August 1997. 365 [RFC2231] Freed, N. and K. Moore, "MIME Parameter Value and 366 Encoded Word Extensions: Character Sets, Languages, and 367 Continuations", RFC 2231, November 1997. 369 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 370 10646", STD 63, RFC 3629, November 2003. 372 [RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration 373 Procedures for Message Header Fields", BCP 90, 374 RFC 3864, September 2004. 376 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, 377 "Uniform Resource Identifier (URI): Generic Syntax", 378 STD 66, RFC 3986, January 2005. 380 Appendix A. Changes from the RFC 2616 Definition 382 Compared to Section 19.5.1 of [RFC2616], the following normative 383 changes reflecting actual implementations have been made: 385 o According to RFC 2616, the disposition type "attachment" only 386 applies to content of type "application/octet-stream". This 387 restriction has been removed, because user agents in practice do 388 not check the content type, and it also discourages properly 389 declaring the media type. 391 o RFC 2616 only allows "quoted-string" for the filename parameter. 392 This would be an exceptional parameter syntax, and also doesn't 393 reflect actual use. 395 o The definition for the disposition type "inline" ([RFC2183], 396 Section 2.1) has been re-added with a suggestion for its 397 processing. 399 o This specification requires support for the extended parameter 400 encoding defined in [RFC5987]. 402 Appendix B. Differences compared to RFC 2183 404 Section 2 of [RFC2183] defines several additional disposition 405 parameters: "creation-date", "modification-date", "quoted-date-time", 406 and "size". These do not appear to be implemented by any user agent, 407 thus have been omitted from this specification. 409 Appendix C. Alternative Approaches to Internationalization 411 By default, HTTP header field parameters cannot carry characters 412 outside the ISO-8859-1 ([ISO-8859-1]) character encoding (see 413 [RFC2616], Section 2.2). For the "filename" parameter, this of 414 course is an unacceptable restriction. 416 Unfortunately, user agent implementers have not managed to come up 417 with an interoperable approach, although the IETF Standards Track 418 specifies exactly one solution ([RFC2231], clarified and profiled for 419 HTTP in [RFC5987]). 421 For completeness, the sections below describe the various approaches 422 that have been tried, and explains how they are inferior to the RFC 423 5987 encoding used in this specification. 425 C.1. RFC 2047 Encoding 427 RFC 2047 defines an encoding mechanism for header fields, but this 428 encoding is not supposed to be used for header field parameters - see 429 Section 5 of [RFC2047]: 431 An 'encoded-word' MUST NOT appear within a 'quoted-string'. 433 ... 435 An 'encoded-word' MUST NOT be used in parameter of a MIME Content- 436 Type or Content-Disposition field, or in any structured field body 437 except within a 'comment' or 'phrase'. 439 In practice, some user agents implement the encoding, some do not 440 (exposing the encoded string to the user), and some get confused by 441 it. 443 C.2. Percent Encoding 445 Some user agents accept percent encoded ([RFC3986], Section 2.1) 446 sequences of characters encoded using the UTF-8 ([RFC3629]) character 447 encoding. 449 In practice, this is hard to use because those user agents that do 450 not support it will display the escaped character sequence to the 451 user. 453 Furthermore, the first user agent to implement this did choose the 454 encoding based on local settings; thus making it very hard to use in 455 multi-lingual environments. 457 C.3. Encoding Sniffing 459 Some user agents inspect the value (which defaults to ISO-8859-1) and 460 switch to UTF-8 when it seems to be more likely to be the correct 461 interpretation. 463 As with the approaches above, this is not interoperable and 464 furthermore risks misinterpreting the actual value. 466 C.4. Implementations (to be removed by RFC Editor before publication) 468 Unfortunately, as of September 2010, neither the encoding defined in 469 RFCs 2231 and 5987, nor any of the alternate approaches discussed 470 above was implemented interoperably. Thus, this specification 471 recommends the approach defined in RFC 5987, which at least has the 472 advantage of actually being specified properly. 474 The table below shows the implementation support for the various 475 approaches: 477 +---------------+------------+--------+--------------+--------------+ 478 | User Agent | RFC | RFC | Percent | Encoding | 479 | | 2231/5987 | 2047 | Encoding | Sniffing | 480 +---------------+------------+--------+--------------+--------------+ 481 | Chrome | no | yes | yes | yes | 482 | Firefox | yes (*) | yes | no | yes | 483 | Internet | no | no | yes | no | 484 | Explorer | | | | | 485 | Konqueror | yes | no | no | no | 486 | Opera | yes (*) | no | no | no | 487 | Safari | no | no | no | yes | 488 +---------------+------------+--------+--------------+--------------+ 490 (*) Does not implement the fallback behavior to "filename" described 491 in Section 3.3. 493 Appendix D. Change Log (to be removed by RFC Editor before publication) 495 D.1. Since draft-reschke-rfc2183-in-http-00 497 Adjust terminology ("header" -> "header field"). Update rfc2231-in- 498 http reference. 500 D.2. Since draft-reschke-rfc2183-in-http-01 502 Update rfc2231-in-http reference. Actually define the "filename" 503 parameter. Add internationalization considerations. Add examples 504 using the RFC 5987 encoding. Add overview over other approaches, 505 plus a table reporting implementation status. Add and resolve issue 506 "nodep2183". Add issues "asciivsiso", "deplboth", "quoted", and 507 "registry". 509 D.3. Since draft-reschke-rfc2183-in-http-02 511 Add and close issue "docfallback". Close issues "asciivsiso", 512 "deplboth", "quoted", and "registry". 514 D.4. Since draft-reschke-rfc2183-in-http-03 516 Updated to be a Working Draft of the IETF HTTPbis Working Group. 518 D.5. Since draft-ietf-httpbis-content-disp-00 520 Closed issues: 522 o : "handling of 523 unknown disposition types" 525 Slightly updated the notes about the proposed fallback behavior. 527 D.6. Since draft-ietf-httpbis-content-disp-01 529 None yet. 531 Index 533 C 534 Content-Disposition header 4 536 H 537 Headers 538 Content-Disposition 4 540 Author's Address 542 Julian F. Reschke 543 greenbytes GmbH 544 Hafenweg 16 545 Muenster, NW 48155 546 Germany 548 EMail: julian.reschke@greenbytes.de 549 URI: http://greenbytes.de/tech/webdav/