On Fri, Jul 17, 2020 at 12:08:20AM +0200, Andreas Thienemann wrote:

> Earlier today I noticed that due to a change of the hostname, the header 
> being added is now longer than 78 characters and is not folded according 
> to RFC2822 rules.

You do not need to worry about this. Until and unless the header
lines exceed 998 bytes (sans CRLF) your message is fine.

    https://tools.ietf.org/html/rfc5322#section-2.1.1

   There are two limits that this specification places on the number of
   characters in a line.  Each line of characters MUST be no more than
   998 characters, and SHOULD be no more than 78 characters, excluding
   the CRLF.

   The 998 character limit is due to limitations in many implementations
   that send, receive, or store IMF messages which simply cannot handle
   more than 998 characters on a line.  Receiving implementations would
   do well to handle an arbitrarily large number of characters in a line
   for robustness sake.  However, there are so many implementations that
   (in compliance with the transport requirements of [RFC5321]) do not
   accept messages containing more than 1000 characters including the CR
   and LF per line, it is important for implementations not to create
   such messages.

   The more conservative 78 character recommendation is to accommodate
   the many implementations of user interfaces that display these
   messages which may truncate, or disastrously wrap, the display of
   more than 78 characters per line, in spite of the fact that such
   implementations are non-conformant to the intent of this
   specification (and that of [RFC5321] if they actually cause
   information to be lost).  Again, even though this limitation is put
   on messages, it is incumbent upon implementations that display
   messages to handle an arbitrarily large number of characters in a
   line (certainly at least up to the 998 character limit) for the sake
   of robustness.

Bottom line, the 78 character is more important for message content,
than trace headers, and it is aspirational, not a hard limit.

DNS hostnames can be up to 253 bytes long, how would you fold a
"Received:" header that contains a 255 byte EHLO name:

    Received: from <255-byte-fqdn> (FcrDNS [address])
        ...

Indeed your message arrived to me with a 94 character (sans CRLF)
Received header:

    Received: from russian-caravan.cloud9.net (russian-caravan.cloud9.net 
[IPv6:2604:8d00:0:1::4])

Bottom line, don't get too worried about the aspirational soft limits.

-- 
    Viktor.

Reply via email to