HTTP/1.1 defines the Content-Disposition response header field, but points out that it is not part of the HTTP/1.1 Standard. This specification takes over the definition and registration of Content-Disposition, as used in HTTP, and clarifies internationalization aspects.
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as “work in progress”.
This Internet-Draft will expire on March 3, 2011.
Copyright © 2010 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
This specification is expected to replace the definition of Content-Disposition in the HTTP/1.1 specification, as currently revised by the IETF HTTPbis working group. See also <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/123>.
Distribution of this document is unlimited. Although this is not a work item of the HTTPbis Working Group, comments should be sent to the Hypertext Transfer Protocol (HTTP) mailing list at firstname.lastname@example.org, which may be joined by sending a message with subject "subscribe" to email@example.com.
Discussions of the HTTPbis Working Group are archived at <http://lists.w3.org/Archives/Public/ietf-http-wg/>.
XML versions, latest edits and the issues list for this document are available from <http://greenbytes.de/tech/webdav/#draft-reschke-rfc2183-in-http>. A collection of test cases is available at <http://greenbytes.de/tech/tc2231/>.
|I edit (type: edit, status: open)|
|firstname.lastname@example.org||2009-10-16||Umbrella issue for editorial fixes/enhancements.|
|Associated changes in this document: 3.3, 5, C.1, C.4, D.|
Content-Disposition is not part of the HTTP standard, but since it is widely implemented, we are documenting its use and risks for implementors.
This specification takes over the definition and registration of Content-Disposition, as used in HTTP. Based on interoperability testing with existing User Agents, it fully defines a profile of the features defined in the
MIME variant ([RFC2183]) of the header field, and also clarifies internationalization aspects.¶
The Content-Disposition response header field is used to convey additional information about how to process the response payload, and also can be used to attach additional metadata, such as the filename.¶
content-disposition = "Content-Disposition" ":" disposition-type *( ";" disposition-parm ) disposition-type = "inline" | "attachment" | disp-ext-type ; case-insensitive disp-ext-type = token disposition-parm = filename-parm | disp-ext-parm filename-parm = "filename" "=" value | "filename*" "=" ext-value disp-ext-parm = token "=" value | ext-token "=" ext-value ext-token = <the characters in token, followed by "*">
|I quoted (type: change, status: closed)|
|email@example.com||2010-08-23||Can value be quoted-pair as well? It is "value" only in RFC 2183, but "quoted-string" only in 2616. UAs seem to handle quoted-strings, although some have trouble unescaping backslashes.|
|firstname.lastname@example.org||2010-08-24||Actually, "value" is "token" or "quoted-string", both in RFC 2616 and RFC 2183 (by reference to RFC 2045). The only problem is that RFC 2616 uses quoted-string instead of value in the definition for the filename parameter. This is a bug in 2616.|
|2010-08-24||Resolution: Note the change in "Changes from the RFC 2616 Definition".|
|Associated changes in this document: A.|
Defined in [RFC2616]:
token = <token, defined in [RFC2616], Section 2.2> value = <value, defined in [RFC2616], Section 3.6>
If the disposition type matches "attachment" (case-insensitively), this indicates that the user agent should not display the response, but directly enter a "save as..." dialog.¶
On the other hand, if it matches "inline" (case-insensitively), this implies default processing.¶
The parameters "filename" and "filename*", to be matched case-insensitively, provide information on how to construct a filename for storing the message payload.¶
Depending on the disposition type, this information might be used right away (in the "save as..." interaction caused for the "attachment" disposition type), or later on (for instance, when the user decides to save the contents of the current page being displayed).¶
"filename" and "filename*" behave the same, except that "filename*" uses the encoding defined in [RFC5987], allowing the use ↓
of non-ASCII characters ([USASCII]). When both "filename" and "filename*" are present, a recipient SHOULD pick "filename*" and ignore "filename" - this will make it possible to send the same header value to clients that do not support "filename↓".¶
|I asciivsiso (type: change, status: closed)|
|email@example.com||2010-08-24||We should be consistent about what RFC 2616 defaults to (ASCII vs ISO-8859-1).|
|2010-08-30||Resolution: Say "ISO-8859-1", and also make the ISO-8859-1 ref normative.|
|Associated changes in this document: 3.3, 4, 5, 9.1, 9.2, 9.2.|
It is essential that user agents treat the specified filename as advisory only, thus be very careful in extracting the desired information. In particular: ¶
When the value contains path separator characters, all but the last segment SHOULD be ignored. This prevents unintentional overwriting of well-known file system location (such as "/etc/passwd").
Many platforms do not use Internet Media Types ([RFC2046]) to hold type information in the file system, but rely on filename extensions instead. Trusting the server-provided file extension could introduce a privilege escalation when later on the file is opened locally (consider ".exe"). Thus, recipients need to ensure that a file extension is used that is safe, optimally matching the media type of the received payload.
Other aspects recipients need to be aware of are names that have a special meaning in the filesystem or in shell commands, such as "." and "..", "~", "|", and also device names.
Direct UA to show "save as" dialog, with a filename of "foo.html":
Content-Disposition: Attachment; filename=foo.html
Direct UA to behave as if the Content-Disposition header field wasn't present, but to remember the filename "foo.html" for a subsequent save operation:
Content-Disposition: INLINE; FILENAME= "foo.html"
Direct UA to show "save as" dialog, with a filename of "an example":
Content-Disposition: Attachment; Filename*=UTF-8'en'an%20example
Note that this example uses the extended encoding defined in [RFC5987] to specify that the natural language of the filename is English, and also to encode the space character which is not allowed in the token production.
Direct UA to show "save as" dialog, with a filename containing the Unicode character U+20AC (EURO SIGN):
Content-Disposition: attachment; filename*= UTF-8''%e2%82%ac%20rates
|I deplboth (type: change, status: closed)|
|firstname.lastname@example.org||2010-08-24||Add an example that uses both "filename" and "filename*" and mention current UA behavior.|
|2010-08-27||Resolution: Add the example, and mention the issues with it.|
|Associated changes in this document: 4.|
Future parameters might also require internationalization, in which case the same encoding can be used.¶
|I registry (type: change, status: closed)|
|email@example.com||2010-08-23||The registry technically is for the MIME header, but has been used for C-D in other protocols already. What's missing are instructions that new registrations should state which protocol they're for. Do we want to attempt to modify the registry?|
|2010-08-30||Resolution: Add a section about extensibility explaining the existing registries.|
|Associated changes in this document: 3.|
Thanks to Rolf Eike Beer, Alfred Hoenes, and Roar Lauritzsen for their valuable feedback.¶
By default, HTTP header field parameters cannot carry characters outside the ISO-8859-1 ([ISO-8859-1]) character encoding (see [RFC2616], Section 2.2). For the "filename" parameter, this of course is an unacceptable restriction.¶
Unfortunately, user agent implementers have not managed to come up with an interoperable approach, although the IETF Standards Track specifies exactly one solution ([RFC2231], clarified and profiled for HTTP in [RFC5987]).¶
For completeness, the sections below describe the various approaches that have been tried, and explains how they are inferior to the RFC 5987 encoding used in this specification.¶
An 'encoded-word' MUST↑ I ↓
-NOT appear within a 'quoted-string'.
An 'encoded-word' MUST NOT be used in parameter of a MIME Content-Type or Content-Disposition field, or in any structured field body except within a 'comment' or 'phrase'.
In practice, some user agents implement the encoding, some do not (exposing the encoded string to the user), and some get confused by it.¶
In practice, this is hard to use because those user agents that do not support it will display the escaped character sequence to the user.¶
Furthermore, the first user agent to implement this did choose the encoding based on local settings; thus making it very hard to use in multi-lingual environments.¶
Some user agents inspect the value (which defaults to ISO-8859-1) and switch to UTF-8 when it seems to be more likely to be the correct interpretation.¶
As with the approaches above, this is not interoperable and furthermore risks misinterpreting the actual value.¶
The table below shows the various encoding approaches and for them in released user agent versions as of August 2010, based on the test cases published at <http://greenbytes.de/tech/tc2231>.
|I docfallback (type: edit, status: closed)|
|firstname.lastname@example.org||2010-08-30||Describe the implementation quality of the fallback behavior.|
|Associated changes in this document: C.4, C.4, C.4.|
|User Agent||RFC 2231/5987||RFC 2047||Percent Encoding||Encoding Sniffing|
Adjust terminology ("header" -> "header field"). Update rfc2231-in-http reference.¶
Update rfc2231-in-http reference. Actually define the "filename" parameter. Add internationalization considerations. Add examples using the RFC 5987 encoding. Add overview over other approaches, plus a table reporting implementation status. Add and resolve issue "nodep2183". Add issues "asciivsiso", "deplboth", "quoted", and "registry".¶