]> git.ipfire.org Git - thirdparty/patchwork.git/commit
parser: parse headers containing invalid characters or codings
authorDaniel Axtens <dja@axtens.net>
Mon, 19 Sep 2016 14:23:58 +0000 (00:23 +1000)
committerStephen Finucane <stephen@that.guru>
Fri, 7 Oct 2016 18:02:32 +0000 (19:02 +0100)
commit6625d4b0dcdf1820b73227c40118625d4db9e130
tree070444388939cc5d30fb057fdcf63e9a08ef1716
parent46b3aa94f5af1959eb0d67f0faa419ab8b107f29
parser: parse headers containing invalid characters or codings

If there is a non-ascii character in a header, parsing fails,
even on Py27.

This has huge Py2/Py3 complexities. The Py3 email package has tools
to handle this - we just need to use them. Py2, on the other hand,
needs a lot of hand-holding, as explained in the comments.

Additionally, support headers that claim an encoding, but fail to
decode with that encoding.

This is handy for mails with malformed headers containing weird
bytes.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reported-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Reviewed-by: Stephen Finucane <stephen@that.guru>
patchwork/parser.py