📄 rfc1521_mime.txt
字号:
[RFC-1342]. This document is a relatively minor updating of RFC
1341, and is intended to supersede it. The differences between this
document and RFC 1341 are summarized in Appendix H. Please refer to
the current edition of the "IAB Official Protocol Standards" for the
standardization state and status of this protocol. Several other RFC
documents will be of interest to the MIME implementor, in particular
[RFC 1343], [RFC-1344], and [RFC-1345].
Borenstein & Freed [Page 5]
RFC 1521 MIME September 1993
2. Notations, Conventions, and Generic BNF Grammar
This document is being published in two versions, one as plain ASCII
text and one as PostScript (PostScript is a trademark of Adobe
Systems Incorporated.). While the text version is the official
specification, some will find the PostScript version easier to read.
The textual contents are identical. An Andrew-format copy of this
document is also available from the first author (Borenstein).
Although the mechanisms specified in this document are all described
in prose, most are also described formally in the modified BNF
notation of RFC 822. Implementors will need to be familiar with this
notation in order to understand this specification, and are referred
to RFC 822 for a complete explanation of the modified BNF notation.
Some of the modified BNF in this document makes reference to
syntactic entities that are defined in RFC 822 and not in this
document. A complete formal grammar, then, is obtained by combining
the collected grammar appendix of this document with that of RFC 822
plus the modifications to RFC 822 defined in RFC 1123, which
specifically changes the syntax for `return', `date' and `mailbox'.
The term CRLF, in this document, refers to the sequence of the two
ASCII characters CR (13) and LF (10) which, taken together, in this
order, denote a line break in RFC 822 mail.
The term "character set" is used in this document to refer to a
method used with one or more tables to convert encoded text to a
series of octets. This definition is intended to allow various kinds
of text encodings, from simple single-table mappings such as ASCII to
complex table switching methods such as those that use ISO 2022's
techniques. However, a MIME character set name must fully specify
the mapping to be performed.
The term "message", when not further qualified, means either the
(complete or "top-level") message being transferred on a network, or
a message encapsulated in a body of type "message".
The term "body part", in this document, means one of the parts of the
body of a multipart entity. A body part has a header and a body, so
it makes sense to speak about the body of a body part.
The term "entity", in this document, means either a message or a body
part. All kinds of entities share the property that they have a
header and a body.
The term "body", when not further qualified, means the body of an
entity, that is the body of either a message or of a body part.
Borenstein & Freed [Page 6]
RFC 1521 MIME September 1993
NOTE: The previous four definitions are clearly circular. This is
unavoidable, since the overall structure of a MIME message is
indeed recursive.
In this document, all numeric and octet values are given in decimal
notation.
It must be noted that Content-Type values, subtypes, and parameter
names as defined in this document are case-insensitive. However,
parameter values are case-sensitive unless otherwise specified for
the specific parameter.
FORMATTING NOTE: This document has been carefully formatted for
ease of reading. The PostScript version of this document, in
particular, places notes like this one, which may be skipped by
the reader, in a smaller, italicized, font, and indents it as
well. In the text version, only the indentation is preserved, so
if you are reading the text version of this you might consider
using the PostScript version instead. However, all such notes will
be indented and preceded by "NOTE:" or some similar introduction,
even in the text version.
The primary purpose of these non-essential notes is to convey
information about the rationale of this document, or to place this
document in the proper historical or evolutionary context. Such
information may be skipped by those who are focused entirely on
building a conformant implementation, but may be of use to those
who wish to understand why this document is written as it is.
For ease of recognition, all BNF definitions have been placed in a
fixed-width font in the PostScript version of this document.
3. The MIME-Version Header Field
Since RFC 822 was published in 1982, there has really been only one
format standard for Internet messages, and there has been little
perceived need to declare the format standard in use. This document
is an independent document that complements RFC 822. Although the
extensions in this document have been defined in such a way as to be
compatible with RFC 822, there are still circumstances in which it
might be desirable for a mail-processing agent to know whether a
message was composed with the new standard in mind.
Therefore, this document defines a new header field, "MIME-Version",
which is to be used to declare the version of the Internet message
body format standard in use.
Messages composed in accordance with this document MUST include such
Borenstein & Freed [Page 7]
RFC 1521 MIME September 1993
a header field, with the following verbatim text:
MIME-Version: 1.0
The presence of this header field is an assertion that the message
has been composed in compliance with this document.
Since it is possible that a future document might extend the message
format standard again, a formal BNF is given for the content of the
MIME-Version field:
version := "MIME-Version" ":" 1*DIGIT "." 1*DIGIT
Thus, future format specifiers, which might replace or extend "1.0",
are constrained to be two integer fields, separated by a period. If
a message is received with a MIME-version value other than "1.0", it
cannot be assumed to conform with this specification.
Note that the MIME-Version header field is required at the top level
of a message. It is not required for each body part of a multipart
entity. It is required for the embedded headers of a body of type
"message" if and only if the embedded message is itself claimed to be
MIME-conformant.
It is not possible to fully specify how a mail reader that conforms
with MIME as defined in this document should treat a message that
might arrive in the future with some value of MIME-Version other than
"1.0". However, conformant software is encouraged to check the
version number and at least warn the user if an unrecognized MIME-
version is encountered.
It is also worth noting that version control for specific content-
types is not accomplished using the MIME-Version mechanism. In
particular, some formats (such as application/postscript) have
version numbering conventions that are internal to the document
format. Where such conventions exist, MIME does nothing to supersede
them. Where no such conventions exist, a MIME type might use a
"version" parameter in the content-type field if necessary.
NOTE TO IMPLEMENTORS: All header fields defined in this document,
including MIME-Version, Content-type, etc., are subject to the
general syntactic rules for header fields specified in RFC 822. In
particular, all can include comments, which means that the following
two MIME-Version fields are equivalent:
MIME-Version: 1.0
MIME-Version: 1.0 (Generated by GBD-killer 3.7)
Borenstein & Freed [Page 8]
RFC 1521 MIME September 1993
4. The Content-Type Header Field
The purpose of the Content-Type field is to describe the data
contained in the body fully enough that the receiving user agent can
pick an appropriate agent or mechanism to present the data to the
user, or otherwise deal with the data in an appropriate manner.
HISTORICAL NOTE: The Content-Type header field was first defined in
RFC 1049. RFC 1049 Content-types used a simpler and less powerful
syntax, but one that is largely compatible with the mechanism given
here.
The Content-Type header field is used to specify the nature of the
data in the body of an entity, by giving type and subtype
identifiers, and by providing auxiliary information that may be
required for certain types. After the type and subtype names, the
remainder of the header field is simply a set of parameters,
specified in an attribute/value notation. The set of meaningful
parameters differs for the different types. In particular, there are
NO globally-meaningful parameters that apply to all content-types.
Global mechanisms are best addressed, in the MIME model, by the
definition of additional Content-* header fields. The ordering of
parameters is not significant. Among the defined parameters is a
"charset" parameter by which the character set used in the body may
be declared. Comments are allowed in accordance with RFC 822 rules
for structured header fields.
In general, the top-level Content-Type is used to declare the general
type of data, while the subtype specifies a specific format for that
type of data. Thus, a Content-Type of "image/xyz" is enough to tell
a user agent that the data is an image, even if the user agent has no
knowledge of the specific image format "xyz". Such information can
be used, for example, to decide whether or not to show a user the raw
data from an unrecognized subtype -- such an action might be
reasonable for unrecognized subtypes of text, but not for
unrecognized subtypes of image or audio. For this reason, registered
subtypes of audio, image, text, and video, should not contain
embedded information that is really of a different type. Such
compound types should be represented using the "multipart" or
"application" types.
Parameters are modifiers of the content-subtype, and do not
fundamentally affect the requirements of the host system. Although
most parameters make sense only with certain content-types, others
are "global" in the sense that they might apply to any subtype. For
example, the "boundary" parameter makes sense only for the
"multipart" content-type, but the "charset" parameter might make
sense with several content-types.
Borenstein & Freed [Page 9]
RFC 1521 MIME September 1993
An initial set of seven Content-Types is defined by this document.
This set of top-level names is intended to be substantially complete.
It is expected that additions to the larger set of supported types
can generally be accomplished by the creation of new subtypes of
these initial types. In the future, more top-level types may be
defined only by an extension to this standard. If another primary
type is to be used for any reason, it must be given a name starting
with "X-" to indicate its non-standard status and to avoid a
potential conflict with a future official name.
In the Augmented BNF notation of RFC 822, a Content-Type header field
value is defined as follows:
content := "Content-Type" ":" type "/" subtype *(";"
parameter)
; case-insensitive matching of type and subtype
type := "application" / "audio"
/ "image" / "message"
/ "multipart" / "text"
/ "video" / extension-token
; All values case-insensitive
extension-token := x-token / iana-token
iana-token := <a publicly-defined extension token,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -