在field-body开头折叠MIMEheaders是否有效?
Is it valid to fold MIME headers at the beginning of field-body?
我正在调试无法解析来自一个电子邮件服务的 header 的 MIME 解析器。电子邮件服务包含一个 header,它由一个完全位于下一行的字段 body 组成,如下所示:
Message-Id:
<12345.67890.abcdef@example.com>
这合法吗?
RFC-822 为有效的 header 指定了以下语法:
3.2. HEADER FIELD DEFINITIONS
These rules show a field meta-syntax, without regard for the
particular type or internal syntax. Their purpose is to permit
detection of fields; also, they present to higher-level parsers
an image of each field as fitting on one line.
field = field-name ":" [ field-body ] CRLF
field-name = 1*<any CHAR, excluding CTLs, SPACE, and ":">
field-body = field-body-contents
[CRLF LWSP-char field-body]
field-body-contents =
<the ASCII characters making up the field-body, as
defined in the following sections, and consisting
of combinations of atom, quoted-string, and
specials tokens, or else consisting of texts>
空字符串是否满足 field-body-contents 以允许 field-body 的 [CRLF LWSP field-body]
部分?
是的,在空白处折叠是完全允许的。通常,只有当行太长时才会这样做,但无论如何这完全是可选的;没有要求折叠,或避免折叠。 (当然,如果一行太长不符合 RFC5321,它 必须 折叠,或者以其他方式缩短。如今,RFC2047 比传统的空白折叠更通用和透明.)
如 https://www.rfc-editor.org/rfc/rfc5322#section-2.2.3 中所述,折叠线是一条“逻辑线”。 (请注意,旧的 822 早已被更新的标准所取代;5322 是当前的替代品。)
我正在调试无法解析来自一个电子邮件服务的 header 的 MIME 解析器。电子邮件服务包含一个 header,它由一个完全位于下一行的字段 body 组成,如下所示:
Message-Id:
<12345.67890.abcdef@example.com>
这合法吗?
RFC-822 为有效的 header 指定了以下语法:
3.2. HEADER FIELD DEFINITIONS
These rules show a field meta-syntax, without regard for the
particular type or internal syntax. Their purpose is to permit
detection of fields; also, they present to higher-level parsers
an image of each field as fitting on one line.
field = field-name ":" [ field-body ] CRLF
field-name = 1*<any CHAR, excluding CTLs, SPACE, and ":">
field-body = field-body-contents
[CRLF LWSP-char field-body]
field-body-contents =
<the ASCII characters making up the field-body, as
defined in the following sections, and consisting
of combinations of atom, quoted-string, and
specials tokens, or else consisting of texts>
空字符串是否满足 field-body-contents 以允许 field-body 的 [CRLF LWSP field-body]
部分?
是的,在空白处折叠是完全允许的。通常,只有当行太长时才会这样做,但无论如何这完全是可选的;没有要求折叠,或避免折叠。 (当然,如果一行太长不符合 RFC5321,它 必须 折叠,或者以其他方式缩短。如今,RFC2047 比传统的空白折叠更通用和透明.)
如 https://www.rfc-editor.org/rfc/rfc5322#section-2.2.3 中所述,折叠线是一条“逻辑线”。 (请注意,旧的 822 早已被更新的标准所取代;5322 是当前的替代品。)