Subject: [Emailcore] "Trace" headers and header pre-pending?

From: Tom Perrine <[email-masked]>
Date: Fri, 6 Aug 2021 18:22:10 +0000

Setting aside any definition of what constitutes a trace-related header, or whether there should be a defined list of them.

I haven’t found a place yet where “forwarding systems MUST/SHOULD prepend any added headers instead of inserting them between already present headers” or similar language. This is being discussed over in the mailops mailing list as a practical issue.

Did I miss this in an RFC or draft? Is making this prescriptive worthwhile? If so SHOULD or MUST?

Most forwarders seem to do this, but some are apparently observed to not prepend and to insert headers in the middle.

Regards,
Tom Perrine

---

From: "Peter J. Holzer" <[email-masked]>
Date: Fri, 6 Aug 2021 22:32:01 +0200

On 2021-08-06 18:22:10 +0000, Tom Perrine wrote:
> Setting aside any definition of what constitutes a trace-related header, or
> whether there should be a defined list of them.
> 
> I haven’t found a place yet where “forwarding systems MUST/SHOULD prepend any
> added headers instead of inserting them between already present headers” or
> similar language. This is being discussed over in the mailops mailing list as a
> practical issue.

I don't think there is such a requirement in general.

There is a requirement that "trace headers" (whatever they are, apart
from the two explicitely mentioned in RFC 5322) are prepended, and
another for the resent-headers (which also need to be added as a block).

There is language in RFC 5322 which suggests that the trace headers
should form a contiguous block at the start of the mail (which would
mean that any non-trace header should be inserted after the trace
headers, i.e. somewhere in the middle). I think this is a bad idea.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | [email-masked]         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

---

From: "Peter J. Holzer" <[email-masked]>
Date: Fri, 6 Aug 2021 22:53:52 +0200

> headers, i.e. somewhere in the middle). I think this is a bad idea.

More specifically:

The syntax allows optional-fields and resent-* interspersed between
trace headers but not the other fields defined in the RFC (orig-date,
from, sender, etc.).

But the text in 3.6 says:

| More importantly, the trace header fields and resent header fields
| MUST NOT be reordered, and SHOULD be kept in blocks prepended to the
| message.

which suggests to me that all the trace headers should be kept together
in a single block. It could be read as "1 or more blocks of trace
headers interspersed with 0 or more blocks of resent-headers", too,
which would be more consistent with the grammar. In any case it doesn't
accont for the optional-fields which are also allowed by the grammar.

There is also a sentence in 4.5:

| Also, the interpretation of trace fields and resent fields that do
| not occur in blocks prepended to the message is unspecified as well.

So when is a trace header not "prepended"? If it occurs after an
"X-Spam-Score" header? Or only if it occurs after a "Subject" header?

        hp

---

From: Francesco Gennai <[email-masked]>
Date: Sat, 7 Aug 2021 08:57:17 +0200

> "X-Spam-Score" header? Or only if it occurs after a "Subject" header?

Prepended is not appended.
You just add the new trace header to the top of the current block of headers.

Francesco

> Emailcore mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/emailcore

---

From: Francesco Gennai <[email-masked]>
Date: Sat, 7 Aug 2021 12:56:22 +0200

Francesco