testInterfacePost: ignore the difference of Message-ID header format on zope5py3.
Showing
-
Owner
I thought that this was a bug, but according to https://datatracker.ietf.org/doc/html/rfc5322#section-2.2.3 it might be OK. Is that also your understanding ? if yes, maybe we can add a reference to that ?
-
Owner
mmh but still, it looks like a bug somewhere, if it's equivalent to have \n in the serialized message, then isn't the parser supposed to remove the extra \n ? I investigated a bit some days ago, these were my notes:
import email mb = ( b'Content-Type: multipart/mixed; boundary="===============boundary=="\n' b'Message-ID: <170831831588.80413.17161314261293097219.17161314261293097219@example.com>\n' b'--===============boundary==--' ) m = email.message_from_bytes(mb) print(repr(m.get('Message-ID'))) # OK '<170831831588.80413.17161314261293097219.17161314261293097219@example.com>' m_from_bytes = email.message_from_bytes(m.as_bytes()) print(repr(m_from_bytes.get('Message-ID'))) # NOT OK '\n <170831831588.80413.17161314261293097219.17161314261293097219@example.com>' # note that when using str it is OK: m_from_str = email.message_from_string(m.as_string()) print(repr(m_from_str.get('Message-ID'))) # OK '<170831831588.80413.17161314261293097219.17161314261293097219@example.com>' # already different here: print(repr(m.as_bytes())) print(repr(m.as_string())) # the output is controlled by max_header_length of the `policy` argument. # not sure if the problem is when emitting the email or parsing it
Please register or sign in to comment