On Apr 11, 2009, at 3:43 AM, Stephen J. Turnbull wrote:
Barry Warsaw writes:So I'm just starting to read RFC 5322 and I'm starting by skimming over Appendix A (differences between RFC 5322 and 2822).I know Barry's a big supporter of the Postel Principle. As aguideline[1], how far back should we be lenient? RFC 822 (no leading "2";-)? Footnotes: [1] Presumably over time we'll accrete definitely non-conforming practices that we need to accept and do something sane with (eg, we can't just raise ArmageddonException because we get a header with 8-bit characters in it). But I think we also should have a plan for formerly acceptable syntax that has been restricted in more recent RFCs, etc.
We could potentially have strict and lenient modes, or possible RFC 822, 2822, 5322 modes. OTOH, I feel very strongly that the parser should accept just about any stream of bytes without throwing an exception. Thinking about an application like Mailman, it's rather inconvenient for the parsing phase to throw any exception. Much better is to register defects and then decide the disposition of messages based on the defect list.
OTOH, when creating messages from whole cloth, I think it's okay to raise exception. You just have to be careful because often the same APIs are used by the parser.
Barry
PGP.sig
Description: This is a digitally signed message part
_______________________________________________ Email-SIG mailing list Email-SIG@python.org Your options: http://mail.python.org/mailman/options/email-sig/archive%40mail-archive.com