source: draft-ietf-httpbis-content-disp/00/draft-ietf-httpbis-content-disp.txt @ 2200

Last change on this file since 2200 was 986, checked in by julian.reschke@…, 13 years ago

Prepare submission of draft-ietf-httpbis-content-disp-00

  • Property svn:executable set to *
File size: 23.6 KB
Line 
1
2
3
4HTTPbis Working Group                                         J. Reschke
5Internet-Draft                                                greenbytes
6Updates: 2616 (if approved)                            September 3, 2010
7Intended status: Standards Track
8Expires: March 7, 2011
9
10
11           Use of the Content-Disposition Header Field in the
12                   Hypertext Transfer Protocol (HTTP)
13                   draft-ietf-httpbis-content-disp-00
14
15Abstract
16
17   HTTP/1.1 defines the Content-Disposition response header field, but
18   points out that it is not part of the HTTP/1.1 Standard.  This
19   specification takes over the definition and registration of Content-
20   Disposition, as used in HTTP, and clarifies internationalization
21   aspects.
22
23Editorial Note (To be removed by RFC Editor before publication)
24
25   This specification is expected to replace the definition of Content-
26   Disposition in the HTTP/1.1 specification, as currently revised by
27   the IETF HTTPbis working group.  See also
28   <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/123>.
29
30   Discussion of this draft should take place on the HTTPBIS working
31   group mailing list (ietf-http-wg@w3.org).  The current issues list is
32   at <http://trac.tools.ietf.org/wg/httpbis/trac/
33   query?component=content-disp> and related documents (including fancy
34   diffs) can be found at <http://tools.ietf.org/wg/httpbis/>.
35
36Status of This Memo
37
38   This Internet-Draft is submitted in full conformance with the
39   provisions of BCP 78 and BCP 79.
40
41   Internet-Drafts are working documents of the Internet Engineering
42   Task Force (IETF).  Note that other groups may also distribute
43   working documents as Internet-Drafts.  The list of current Internet-
44   Drafts is at http://datatracker.ietf.org/drafts/current/.
45
46   Internet-Drafts are draft documents valid for a maximum of six months
47   and may be updated, replaced, or obsoleted by other documents at any
48   time.  It is inappropriate to use Internet-Drafts as reference
49   material or to cite them other than as "work in progress."
50
51   This Internet-Draft will expire on March 7, 2011.
52
53
54
55Reschke                   Expires March 7, 2011                 [Page 1]
56
57Internet-Draft         Content-Disposition in HTTP        September 2010
58
59
60Copyright Notice
61
62   Copyright (c) 2010 IETF Trust and the persons identified as the
63   document authors.  All rights reserved.
64
65   This document is subject to BCP 78 and the IETF Trust's Legal
66   Provisions Relating to IETF Documents
67   (http://trustee.ietf.org/license-info) in effect on the date of
68   publication of this document.  Please review these documents
69   carefully, as they describe your rights and restrictions with respect
70   to this document.  Code Components extracted from this document must
71   include Simplified BSD License text as described in Section 4.e of
72   the Trust Legal Provisions and are provided without warranty as
73   described in the Simplified BSD License.
74
75Table of Contents
76
77   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  4
78   2.  Notational Conventions . . . . . . . . . . . . . . . . . . . .  4
79   3.  Header Field Definition  . . . . . . . . . . . . . . . . . . .  4
80     3.1.  Grammar  . . . . . . . . . . . . . . . . . . . . . . . . .  5
81     3.2.  Disposition Type . . . . . . . . . . . . . . . . . . . . .  5
82     3.3.  Disposition Parameter: 'Filename'  . . . . . . . . . . . .  5
83     3.4.  Disposition Parameter: Extensions  . . . . . . . . . . . .  6
84     3.5.  Extensibility  . . . . . . . . . . . . . . . . . . . . . .  6
85   4.  Examples . . . . . . . . . . . . . . . . . . . . . . . . . . .  7
86   5.  Internationalization Considerations  . . . . . . . . . . . . .  7
87   6.  Security Considerations  . . . . . . . . . . . . . . . . . . .  8
88   7.  IANA Considerations  . . . . . . . . . . . . . . . . . . . . .  8
89     7.1.  Registry for Disposition Values and Parameter  . . . . . .  8
90     7.2.  Header Field Registration  . . . . . . . . . . . . . . . .  8
91   8.  Acknowledgements . . . . . . . . . . . . . . . . . . . . . . .  8
92   9.  References . . . . . . . . . . . . . . . . . . . . . . . . . .  8
93     9.1.  Normative References . . . . . . . . . . . . . . . . . . .  8
94     9.2.  Informative References . . . . . . . . . . . . . . . . . .  9
95   Appendix A.  Changes from the RFC 2616 Definition  . . . . . . . .  9
96   Appendix B.  Differences compared to RFC 2183  . . . . . . . . . . 10
97   Appendix C.  Alternative Approaches to Internationalization  . . . 10
98     C.1.  RFC 2047 Encoding  . . . . . . . . . . . . . . . . . . . . 10
99     C.2.  Percent Encoding . . . . . . . . . . . . . . . . . . . . . 11
100     C.3.  Encoding Sniffing  . . . . . . . . . . . . . . . . . . . . 11
101     C.4.  Implementations  . . . . . . . . . . . . . . . . . . . . . 11
102   Appendix D.  Change Log (to be removed by RFC Editor before
103                publication)  . . . . . . . . . . . . . . . . . . . . 12
104     D.1.  Since draft-reschke-rfc2183-in-http-00 . . . . . . . . . . 12
105     D.2.  Since draft-reschke-rfc2183-in-http-01 . . . . . . . . . . 12
106     D.3.  Since draft-reschke-rfc2183-in-http-02 . . . . . . . . . . 12
107     D.4.  Since draft-reschke-rfc2183-in-http-03 . . . . . . . . . . 12
108
109
110
111Reschke                   Expires March 7, 2011                 [Page 2]
112
113Internet-Draft         Content-Disposition in HTTP        September 2010
114
115
116   Index  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167Reschke                   Expires March 7, 2011                 [Page 3]
168
169Internet-Draft         Content-Disposition in HTTP        September 2010
170
171
1721.  Introduction
173
174   HTTP/1.1 defines the Content-Disposition response header field in
175   Section 19.5.1 of [RFC2616], but points out that it is not part of
176   the HTTP/1.1 Standard (Section 15.5):
177
178      Content-Disposition is not part of the HTTP standard, but since it
179      is widely implemented, we are documenting its use and risks for
180      implementers.
181
182   This specification takes over the definition and registration of
183   Content-Disposition, as used in HTTP.  Based on interoperability
184   testing with existing User Agents, it fully defines a profile of the
185   features defined in the Multipurpose Internet Mail Extensions (MIME)
186   variant ([RFC2183]) of the header field, and also clarifies
187   internationalization aspects.
188
1892.  Notational Conventions
190
191   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
192   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
193   document are to be interpreted as described in [RFC2119].
194
195   This specification uses the augmented BNF notation defined in Section
196   2.1 of [RFC2616], including its rules for linear whitespace (LWS).
197
1983.  Header Field Definition
199
200   The Content-Disposition response header field is used to convey
201   additional information about how to process the response payload, and
202   also can be used to attach additional metadata, such as the filename.
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223Reschke                   Expires March 7, 2011                 [Page 4]
224
225Internet-Draft         Content-Disposition in HTTP        September 2010
226
227
2283.1.  Grammar
229
230     content-disposition = "Content-Disposition" ":"
231                            disposition-type *( ";" disposition-parm )
232
233     disposition-type    = "inline" | "attachment" | disp-ext-type
234                         ; case-insensitive
235     disp-ext-type       = token
236
237     disposition-parm    = filename-parm | disp-ext-parm
238
239     filename-parm       = "filename" "=" value
240                         | "filename*" "=" ext-value
241
242     disp-ext-parm       = token "=" value
243                         | ext-token "=" ext-value
244     ext-token           = <the characters in token, followed by "*">
245
246   Defined in [RFC2616]:
247
248     token       = <token, defined in [RFC2616], Section 2.2>
249     value       = <value, defined in [RFC2616], Section 3.6>
250
251   Defined in [RFC5987]:
252
253     ext-value   = <ext-value, defined in [RFC5987], Section 3.2>
254
2553.2.  Disposition Type
256
257   If the disposition type matches "attachment" (case-insensitively),
258   this indicates that the user agent should not display the response,
259   but directly enter a "save as..." dialog.
260
261   On the other hand, if it matches "inline" (case-insensitively), this
262   implies default processing.
263
264   Other disposition types SHOULD be handled the same way as
265   "attachment" (see also [RFC2183], Section 2.8).
266
2673.3.  Disposition Parameter: 'Filename'
268
269   The parameters "filename" and "filename*", to be matched case-
270   insensitively, provide information on how to construct a filename for
271   storing the message payload.
272
273   Depending on the disposition type, this information might be used
274   right away (in the "save as..." interaction caused for the
275   "attachment" disposition type), or later on (for instance, when the
276
277
278
279Reschke                   Expires March 7, 2011                 [Page 5]
280
281Internet-Draft         Content-Disposition in HTTP        September 2010
282
283
284   user decides to save the contents of the current page being
285   displayed).
286
287   "filename" and "filename*" behave the same, except that "filename*"
288   uses the encoding defined in [RFC5987], allowing the use of
289   characters not present in the ISO-8859-1 character set
290   ([ISO-8859-1]).  When both "filename" and "filename*" are present, a
291   recipient SHOULD pick "filename*" and ignore "filename" - this will
292   make it possible to send the same header value to clients that do not
293   support "filename*".
294
295   It is essential that user agents treat the specified filename as
296   advisory only, thus be very careful in extracting the desired
297   information.  In particular:
298
299   o  When the value contains path separator characters, all but the
300      last segment SHOULD be ignored.  This prevents unintentional
301      overwriting of well-known file system location (such as "/etc/
302      passwd").
303
304   o  Many platforms do not use Internet Media Types ([RFC2046]) to hold
305      type information in the file system, but rely on filename
306      extensions instead.  Trusting the server-provided file extension
307      could introduce a privilege escalation when later on the file is
308      opened locally (consider ".exe").  Thus, recipients need to ensure
309      that a file extension is used that is safe, optimally matching the
310      media type of the received payload.
311
312   o  Other aspects recipients need to be aware of are names that have a
313      special meaning in the filesystem or in shell commands, such as
314      "." and "..", "~", "|", and also device names.
315
3163.4.  Disposition Parameter: Extensions
317
318   To enable future extensions, unknown parameters SHOULD be ignored
319   (see also [RFC2183], Section 2.8).
320
3213.5.  Extensibility
322
323   Note that Section 9 of [RFC2183] defines IANA registries both for
324   disposition types and disposition parameters.  This registry is
325   shared by different protocols using Content-Disposition, such as MIME
326   and HTTP.  Therefore, not all registered values may make sense in the
327   context of HTTP.
328
329
330
331
332
333
334
335Reschke                   Expires March 7, 2011                 [Page 6]
336
337Internet-Draft         Content-Disposition in HTTP        September 2010
338
339
3404.  Examples
341
342   Direct UA to show "save as" dialog, with a filename of "foo.html":
343
344   Content-Disposition: Attachment; filename=foo.html
345
346   Direct UA to behave as if the Content-Disposition header field wasn't
347   present, but to remember the filename "foo.html" for a subsequent
348   save operation:
349
350   Content-Disposition: INLINE; FILENAME= "foo.html"
351
352   Direct UA to show "save as" dialog, with a filename of "an example":
353
354   Content-Disposition: Attachment; Filename*=UTF-8'en'an%20example
355
356   Note that this example uses the extended encoding defined in
357   [RFC5987] to specify that the natural language of the filename is
358   English, and also to encode the space character which is not allowed
359   in the token production.
360
361   Direct UA to show "save as" dialog, with a filename containing the
362   Unicode character U+20AC (EURO SIGN):
363
364   Content-Disposition: attachment; filename*= UTF-8''%e2%82%ac%20rates
365
366   Here, the encoding defined in [RFC5987] is also used to encode the
367   non-ISO-8859-1 character.
368
369   Same as above, but adding the "filename" parameter for compatibility
370   with user agents not implementing RFC 5987:
371
372   Content-Disposition: attachment; filename="EURO rates";
373                                    filename*=utf-8''%e2%82%ac%20rates
374
375   Note: as of August 2010, many user agents unfortunately did not
376   properly handle unexpected parameters, and some that implement RFC
377   5987 did not pick the extended parameter when both were present.
378
3795.  Internationalization Considerations
380
381   The "filename*" parameter (Section 3.3), using the encoding defined
382   in [RFC5987], allows the server to transmit characters outside the
383   ISO-8859-1 character set, and also to optionally specify the language
384   in use.
385
386   Future parameters might also require internationalization, in which
387   case the same encoding can be used.
388
389
390
391Reschke                   Expires March 7, 2011                 [Page 7]
392
393Internet-Draft         Content-Disposition in HTTP        September 2010
394
395
3966.  Security Considerations
397
398   Using server-supplied information for constructing local filenames
399   introduces many risks.  These are summarized in Section 3.3.
400
401   Furthermore, implementers also ought to be aware of the Security
402   Considerations applying to HTTP (see Section 15 of [RFC2616]), and
403   also the parameter encoding defined in [RFC5987] (see Appendix ).
404
4057.  IANA Considerations
406
4077.1.  Registry for Disposition Values and Parameter
408
409   This specification does not introduce any changes to the registration
410   procedures for disposition values and parameters that are defined in
411   Section 9 of [RFC2183].
412
4137.2.  Header Field Registration
414
415   This document updates the definition of the Content-Disposition HTTP
416   header field in the permanent HTTP header field registry (see
417   [RFC3864]).
418
419   Header field name:  Content-Disposition
420
421   Applicable protocol:  http
422
423   Status:  standard
424
425   Author/Change controller:  IETF
426
427   Specification document:  this specification (Section 3)
428
4298.  Acknowledgements
430
431   Thanks to Rolf Eike Beer, Alfred Hoenes, and Roar Lauritzsen for
432   their valuable feedback.
433
4349.  References
435
4369.1.  Normative References
437
438   [ISO-8859-1]  International Organization for Standardization,
439                 "Information technology -- 8-bit single-byte coded
440                 graphic character sets -- Part 1: Latin alphabet No.
441                 1", ISO/IEC 8859-1:1998, 1998.
442
443   [RFC2119]     Bradner, S., "Key words for use in RFCs to Indicate
444
445
446
447Reschke                   Expires March 7, 2011                 [Page 8]
448
449Internet-Draft         Content-Disposition in HTTP        September 2010
450
451
452                 Requirement Levels", BCP 14, RFC 2119, March 1997.
453
454   [RFC2616]     Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
455                 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext
456                 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.
457
458   [RFC5987]     Reschke, J., "Applicability of RFC 2231 Encoding to
459                 Hypertext Transfer Protocol (HTTP) Headers", RFC 5987,
460                 August 2010.
461
4629.2.  Informative References
463
464   [RFC2046]     Freed, N. and N. Borenstein, "Multipurpose Internet
465                 Mail Extensions (MIME) Part Two: Media Types",
466                 RFC 2046, November 1996.
467
468   [RFC2047]     Moore, K., "MIME (Multipurpose Internet Mail
469                 Extensions) Part Three: Message Header Extensions for
470                 Non-ASCII Text", RFC 2047, November 1996.
471
472   [RFC2183]     Troost, R., Dorner, S., and K. Moore, "Communicating
473                 Presentation Information in Internet Messages: The
474                 Content-Disposition Header Field", RFC 2183,
475                 August 1997.
476
477   [RFC2231]     Freed, N. and K. Moore, "MIME Parameter Value and
478                 Encoded Word Extensions: Character Sets, Languages, and
479                 Continuations", RFC 2231, November 1997.
480
481   [RFC3629]     Yergeau, F., "UTF-8, a transformation format of ISO
482                 10646", RFC 3629, STD 63, November 2003.
483
484   [RFC3864]     Klyne, G., Nottingham, M., and J. Mogul, "Registration
485                 Procedures for Message Header Fields", BCP 90,
486                 RFC 3864, September 2004.
487
488   [RFC3986]     Berners-Lee, T., Fielding, R., and L. Masinter,
489                 "Uniform Resource Identifier (URI): Generic Syntax",
490                 RFC 3986, STD 66, January 2005.
491
492Appendix A.  Changes from the RFC 2616 Definition
493
494   Compared to Section 19.5.1 of [RFC2616], the following normative
495   changes reflecting actual implementations have been made:
496
497   o  According to RFC 2616, the disposition type "attachment" only
498      applies to content of type "application/octet-stream".  This
499      restriction has been removed, because user agents in practice do
500
501
502
503Reschke                   Expires March 7, 2011                 [Page 9]
504
505Internet-Draft         Content-Disposition in HTTP        September 2010
506
507
508      not check the content type, and it also discourages properly
509      declaring the media type.
510
511   o  RFC 2616 only allows "quoted-string" for the filename parameter.
512      This would be an exceptional parameter syntax, and also doesn't
513      reflect actual use.
514
515   o  The definition for the disposition type "inline" ([RFC2183],
516      Section 2.1) has been re-added with a suggestion for its
517      processing.
518
519   o  This specification requires support for the extended parameter
520      encoding defined in [RFC5987].
521
522Appendix B.  Differences compared to RFC 2183
523
524   Section 2 of [RFC2183] defines several additional disposition
525   parameters: "creation-date", "modification-date", "quoted-date-time",
526   and "size".  These do not appear to be implemented by any user agent,
527   thus have been omitted from this specification.
528
529Appendix C.  Alternative Approaches to Internationalization
530
531   By default, HTTP header field parameters cannot carry characters
532   outside the ISO-8859-1 ([ISO-8859-1]) character encoding (see
533   [RFC2616], Section 2.2).  For the "filename" parameter, this of
534   course is an unacceptable restriction.
535
536   Unfortunately, user agent implementers have not managed to come up
537   with an interoperable approach, although the IETF Standards Track
538   specifies exactly one solution ([RFC2231], clarified and profiled for
539   HTTP in [RFC5987]).
540
541   For completeness, the sections below describe the various approaches
542   that have been tried, and explains how they are inferior to the RFC
543   5987 encoding used in this specification.
544
545C.1.  RFC 2047 Encoding
546
547   RFC 2047 defines an encoding mechanism for header fields, but this
548   encoding is not supposed to be used for header field parameters - see
549   Section 5 of [RFC2047]:
550
551      An 'encoded-word' MUST NOT appear within a 'quoted-string'.
552
553      ...
554
555
556
557
558
559Reschke                   Expires March 7, 2011                [Page 10]
560
561Internet-Draft         Content-Disposition in HTTP        September 2010
562
563
564      An 'encoded-word' MUST NOT be used in parameter of a MIME Content-
565      Type or Content-Disposition field, or in any structured field body
566      except within a 'comment' or 'phrase'.
567
568   In practice, some user agents implement the encoding, some do not
569   (exposing the encoded string to the user), and some get confused by
570   it.
571
572C.2.  Percent Encoding
573
574   Some user agents accept percent encoded ([RFC3986], Section 2.1)
575   sequences of characters encoded using the UTF-8 ([RFC3629]) character
576   encoding.
577
578   In practice, this is hard to use because those user agents that do
579   not support it will display the escaped character sequence to the
580   user.
581
582   Furthermore, the first user agent to implement this did choose the
583   encoding based on local settings; thus making it very hard to use in
584   multi-lingual environments.
585
586C.3.  Encoding Sniffing
587
588   Some user agents inspect the value (which defaults to ISO-8859-1) and
589   switch to UTF-8 when it seems to be more likely to be the correct
590   interpretation.
591
592   As with the approaches above, this is not interoperable and
593   furthermore risks misinterpreting the actual value.
594
595C.4.  Implementations
596
597   Unfortunately, as of August 2010, neither the encoding defined in
598   RFCs 2231 and 5789, nor any of the alternate approaches discussed
599   above was implemented interoperably.  Thus, this specification
600   recommends the approach defined in RFC 5987, which at least has the
601   advantage of actually being specified properly.
602
603   The table below shows the implementation support for the various
604   approaches: [[impls: Discuss: should we mention the implementation
605   status of actual UAs in a RFC?  Up to the IESG to decide...]]
606
607
608
609
610
611
612
613
614
615Reschke                   Expires March 7, 2011                [Page 11]
616
617Internet-Draft         Content-Disposition in HTTP        September 2010
618
619
620   +---------------+------------+--------+--------------+--------------+
621   | User Agent    | RFC        | RFC    | Percent      | Encoding     |
622   |               | 2231/5987  | 2047   | Encoding     | Sniffing     |
623   +---------------+------------+--------+--------------+--------------+
624   | Chrome        | no         | yes    | yes          | yes          |
625   | Firefox       | yes (*)    | yes    | no           | yes          |
626   | Internet      | no         | no     | yes          | no           |
627   | Explorer      |            |        |              |              |
628   | Konqueror     | yes        | no     | no           | no           |
629   | Opera         | yes (*)    | no     | no           | no           |
630   | Safari        | no         | no     | no           | yes          |
631   +---------------+------------+--------+--------------+--------------+
632
633   (*) Does not implement the fallback behavior to "filename" described
634   in Section 3.3.
635
636Appendix D.  Change Log (to be removed by RFC Editor before publication)
637
638D.1.  Since draft-reschke-rfc2183-in-http-00
639
640   Adjust terminology ("header" -> "header field").  Update rfc2231-in-
641   http reference.
642
643D.2.  Since draft-reschke-rfc2183-in-http-01
644
645   Update rfc2231-in-http reference.  Actually define the "filename"
646   parameter.  Add internationalization considerations.  Add examples
647   using the RFC 5987 encoding.  Add overview over other approaches,
648   plus a table reporting implementation status.  Add and resolve issue
649   "nodep2183".  Add issues "asciivsiso", "deplboth", "quoted", and
650   "registry".
651
652D.3.  Since draft-reschke-rfc2183-in-http-02
653
654   Add and close issue "docfallback".  Close issues "asciivsiso",
655   "deplboth", "quoted", and "registry".
656
657D.4.  Since draft-reschke-rfc2183-in-http-03
658
659   Updated to be a Working Draft of the IETF HTTPbis Working Group.
660
661Index
662
663   C
664      Content-Disposition header  4
665
666   H
667      Headers
668
669
670
671Reschke                   Expires March 7, 2011                [Page 12]
672
673Internet-Draft         Content-Disposition in HTTP        September 2010
674
675
676         Content-Disposition  4
677
678Author's Address
679
680   Julian F. Reschke
681   greenbytes GmbH
682   Hafenweg 16
683   Muenster, NW  48155
684   Germany
685
686   EMail: julian.reschke@greenbytes.de
687   URI:   http://greenbytes.de/tech/webdav/
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727Reschke                   Expires March 7, 2011                [Page 13]
728
Note: See TracBrowser for help on using the repository browser.