On 5.10.2004, at 17:29, Mark E. Mallett wrote:
Dovecot (and eg. mutt) uses Content-Length header to figure out how large the message body is, so clients can't mess anything by sending From-lines. Also Dovecot requires that From-line has correct syntax and valid timestamp or it's not treated as From-line.
Cool.. Just a little devil's advocation here:
That's great as long as dovecot is the only one that will ever touch the mbox.
Right. Perhaps it should be optional. Although I'm not sure how hard I want Dovecot to try to be backwards compatible with all kinds of mbox software.
There are a lot of different "correct" formats of "From " lines, including some homegrown ones, and there are various code bases out there that recognize "From " separators in different ways. That's one reason that intelligent "From " quoting/recognition is not always better than being dumb about it (IMHO at least). I favor being aware of the fact that you might be maintaining an mbox that has to be compatible with all manners of access.
I think Dovecot has pretty similiar From-line requirements than UW-IMAP, or at least I once did some changes to make sure it parsed all the same ones.
As an aside, mutt uses content-length only if available, and calculates it if not (I would assume dovecot generates it always, if it's going to rely on it?).
I meant when Dovecot or mutt saves mails, it always adds the Content-Length header. When parsing mails without Content-Length, it's added only if doing so doesn't cause much extra disk I/O and if the message size is >= 1024 bytes (ie. when jumping over the message might actually reduce disk reads).
(and in fact mutt, up to 1.4.2.1 at least, is broken in the way it recognizes "From " lines if the content-length is missing: specifically, it would recognize "From " lines even if not preceded by a blank line.. I patched it here.)
I don't think From-line has to be preceded by empty line? My understanding is that mbox works like:
From ... LF message text LF
If message text doesn't end with LF, there's no empty line before From-line.