Network Working Group | J. Reschke |
Internet-Draft | greenbytes |
Intended status: Standards Track | August 15, 2008 |
Expires: February 16, 2009 |
By submitting this Internet-Draft, each author represents that any applicable patent or other IPR claims of which he or she is aware have been or will be disclosed, and any of which he or she becomes aware will be disclosed, in accordance with Section 6 of BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts.¶
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”.¶
The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt.¶
The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html.¶
This Internet-Draft will expire on February 16, 2009.¶
By default, message header parameters in Hypertext Transfer Protocol (HTTP) messages can not carry characters outside the ISO-8859-1 character set. RFC 2231 defines an escaping mechanism for use in Multipurpose Internet Mail Extensions (MIME) headers. This document specifies a profile of that encoding suitable for use in HTTP.¶
There are multiple HTTP headers that already use RFC 2231 encoding in practice (Content-Disposition) or might use it in the future (Link). The purpose of this document is to provide a single place where the generic aspects of RFC 2231 encoding in HTTP headers are defined.¶
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 ietf-http-wg@w3.org, which may be joined by sending a message with subject "subscribe" to ietf-http-wg-request@w3.org.¶
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-rfc2231-in-http>.¶
By default, message header parameters in HTTP ([RFC2616]) messages can not carry characters outside the ISO-8859-1 character set ([ISO-8859-1]). RFC 2231 ([RFC2231]) defines an escaping mechanism for use in MIME headers. This document specifies a profile of that encoding for use in HTTP.¶
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].¶
This specification uses the augmented BNF notation defined in Section 2.1 of [RFC2616], including its rules for linear whitespace (LWS). [LWS: This needs to be checked.] ¶
Non-ASCII characters used in prose for examples are encoded using the format "Backslash-U with Delimiters", defined in Section 5.1 of [RFC5137].¶
RFC 2231 defines several extensions to MIME. The sections below discuss if and how they apply to HTTP.¶
In short: ¶
Section 3 of [RFC2231] defines a mechanism that deals with the length limitations that apply to MIME headers. These limitations do not apply to HTTP ([RFC2616], Section 19.4.7).¶
Thus in HTTP, senders MUST NOT use parameter continuations, and therefore recipients do not need to support them.¶
Section 4 of [RFC2231] specifies how to embed language information into parameter values, and also how to encode non-ASCII characters, dealing with restrictions both in MIME and HTTP header parameters.¶
However, RFC 2231 does not specify mandatory-to-implement character encoding, making it hard for senders to decide which character set to use. Thus, recipients implementing this specification MUST support the character sets "ISO-8859-1" [ISO-8859-1] and "UTF-8" [RFC3629].¶
Furthermore, RFC 2231 allows leaving out the character encoding information. The profile defined by this specification does not allow that.¶
The syntax for parameters is defined in Section 3.6 of [RFC2616]:¶
parameter = attribute "=" value
attribute = token value = token | quoted-string quoted-string = <quoted-string, defined in [RFC2616], Section 2.2> token = <token, defined in [RFC2616], Section 2.2>
This specification extends the grammar to:¶
parameter = reg-parameter | ext-parameter reg-parameter = attribute "=" value ext-parameter = attribute "*=" ext-value ext-value = charset "'" [ language ] "'" value-chars charset = "UTF-8" | "ISO-8859-1" | ext-charset ; NOTE: case-insensitive ext-charset = token ; see IANA charset registry ; (<http://www.iana.org/assignments/character-sets>) language = <Language-Tag, defined in [RFC4646], Section 2.1> value-chars = *( pct-encoded | attr-char ) pct-encoded = "%" HEXDIG HEXDIG attr-char = ALPHA | DIGIT | "-" | "." | "_" | "~" | ":" | "!" | "$" | "&" | "+" ALPHA = %x41-5A | %x61-7A ; A-Z | a-z DIGIT = %x30-39 ; any US-ASCII digit "0".."9" HEXDIG = DIGIT | "A" | "B" | "C" | "D" | "E" | "F" ; NOTE: case-insensitive
Non-extended notation, using "token":
foo: bar; title=Economy
Non-extended notation, using "quoted-string":
foo: bar; title="US-$ rates"
Extended notation, using the unicode character \u'00A3' (POUND SIGN):
foo: bar; title*=iso-8859-1'en'%A3%20rates
Note: the Unicode pound sign character \u'00A3' was encoded using ISO-8859-1 into the single octet A3, then percent-encoded. Also note that the space character was encoded as %20, as attr-char does not contain it.
Extended notation, using the unicode characters \u'00A3' (POUND SIGN) and \u'20AC' (EURO SIGN):
foo: bar; title*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates
Note: the unicode pound sign character \u'00A3' was encoded using UTF-8 into the octet sequence C2 A3, then percent-encoded. Likewise, the unicode euro sign character \u'20AC' was encoded into the octet sequence E2 82 AC, then percent-encoded. Also note that HEXDIG allows both lower-case and upper-case character, so recipients must understand both, and that the language information is optional, while the character set is not.
Section 5 of [RFC2231] extends the encoding defined in [RFC2047] to also support language specification in encoded words. Although the HTTP/1.1 does refer to RFC 2047 ([RFC2616], Section 2.2), it's not clear to which header field exactly it applies, and whether it is implemented in practice (see <http://tools.ietf.org/wg/httpbis/trac/ticket/111> for details).¶
Thus, the RFC 2231 profile defined by this specification does not include this feature.¶
Specifications of HTTP headers that use the extensions defined in Section 3.2 should clearly state that. The best way to achieve this is to normatively reference this specification, and to include the ext-parameter production into the ABNF for that header.¶
Section 4.2 of [RFC2277] requires that protocol elements containing text can carry language information. Thus, the ext-parameter production should always be used when the parameter value is of textual nature.¶
Header specifications that include parameters should also specify whether same-named parameters can occur multiple times. If repetitions are not allowed (and this is believed to be the common case), the specification should state whether regular or the extended syntax takes precedence. In the latter case, this could be used by senders to use both formats without breaking recipients that do not understand the syntax.¶
Example:
foo: bar; title="EURO exchange rates"; title*=utf-8''%e2%82%ac%20exchange%20rates
In this case, the sender provides an ASCII version of the title for legacy recipient, but also includes an internationalized version for recipients understanding this specification -- the latter obviously should prefer the new syntax over the old one.
This document does not discuss security issues and is not believed to raise any security issues not already endemic in HTTP.¶
There are no IANA Considerations related to this specification.¶
Thanks to Frank Ellermann for help figuring out BNF details.¶
Copyright © The IETF Trust (2008).¶
This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights.¶
This document and the information contained herein are provided on an “AS IS” basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.¶
The IETF takes no position regarding the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; nor does it represent that it has made any independent effort to identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and BCP 79.¶
Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users of this specification can be obtained from the IETF on-line IPR repository at http://www.ietf.org/ipr.¶
The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implement this standard. Please address the information to the IETF at ietf-ipr@ietf.org.¶