This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author bryced
Recipients barry, bryced, r.david.murray
Date 2018-07-30.05:32:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1532928773.1.0.56676864532.issue34277@psf.upfronthosting.co.za>
In-reply-to
Content
Starting in 3.6.4, the header flattening ignores the EmailyPolicy.utf8 attribute if a header is longer than maxlen.  I believe this was introduced in https://github.com/python/cpython/pull/4693.  Specifically this part: https://github.com/miss-islington/cpython/blob/8085ac188785ad0301760869a08b83c2945257a4/Lib/email/_header_value_parser.py#L2668-L2673

This causes problems as the dkim-signature header of parsed email messages gets mangled when they are flattened.

It should look like this:

    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1532918961; bh=AwLeVe/FpXHJ9+VNy8QKwz2N5wuNF5ZkyXE3tLVBrFY=; h=Date:From:Reply-To:To:Subject:References:From:Subject; b=rSWZ7vyWIZqflUJS9ysVQvDxeoMxepEqPr/EoVkqpilCP1ryvci6/jCsFe75M2Jr5NJjzg6yJ6Xew8rpq8SMnZeNhTMmCK8jy\r\n WwSamcZ14t0LUZEt30+9Ump0KbPq+WRQK2rM9NnBVhE6pyvANfgsKMqgXlYzAmHk7P8cZ7ztJMSrtOeOr3u5RRNwvYJ+OYHZSFHiQZrPopNDKovVBcAc+6yVBI3YsI1qsgDmoQ/F5NszOLsBit2IkcvWr7z [...]

but instead gets output like this:

    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;\r\n t=1532918961; bh=AwLeVe/FpXHJ9+VNy8QKwz2N5wuNF5ZkyXE3tLVBrFY=;\r\n h=Date:From:Reply-To:To:Subject:References:From:Subject; =?utf-8?q?b=3DrSWZ?=\r\n =?utf-8?q?7vyWIZqflUJS9ysVQvDxeoMxepEqPr/EoVkqpilCP1ryvci6/jCsFe75M2Jr5NJjz?=\r\n =?utf-8?q?g6yJ6Xew8rpq8SMnZeN [...]

Attached is a test that passes in 3.6.3 and fails in 3.6.4.
History
Date User Action Args
2018-07-30 05:32:53brycedsetrecipients: + bryced, barry, r.david.murray
2018-07-30 05:32:53brycedsetmessageid: <1532928773.1.0.56676864532.issue34277@psf.upfronthosting.co.za>
2018-07-30 05:32:53brycedlinkissue34277 messages
2018-07-30 05:32:52brycedcreate