cpython/Lib/test/test_email
Łukasz Langa 06f28dc236
[3.10] gh-121650: Encode newlines in headers, and verify headers are sound (GH-122233) (#122609)
Per RFC 2047:

> [...] these encoding schemes allow the
> encoding of arbitrary octet values, mail readers that implement this
> decoding should also ensure that display of the decoded data on the
> recipient's terminal will not cause unwanted side-effects

It seems that the "quoted-word" scheme is a valid way to include
a newline character in a header value, just like we already allow
undecodable bytes or control characters.
They do need to be properly quoted when serialized to text, though.

This should fail for custom fold() implementations that aren't careful
about newlines.

(cherry picked from commit 0976339818)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Bas Bloemsaat <bas@bloemsaat.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-09-04 17:38:31 +02:00
..
data Optimize images by IMGbot (GH-21348) 2022-02-04 16:31:21 +09:00
__init__.py bpo-43651: PEP 597: Fix test_email (GH-25158) 2021-04-05 12:30:12 +09:00
__main__.py
test__encoded_words.py bpo-43323: Fix UnicodeEncodeError in the email module (GH-32137) 2022-04-30 05:31:28 -07:00
test__header_value_parser.py [3.10] bpo-46198: rename duplicate tests and remove unused code (GH-30297) (GH-31796) 2022-03-10 13:53:50 -08:00
test_asian_codecs.py
test_contentmanager.py bpo-41402: Fix email ContentManager calling .encode() on bytes (GH-21631) 2021-08-09 16:44:17 -07:00
test_defect_handling.py
test_email.py gh-95087: Fix IndexError in parsing invalid date in the email module (GH-95201) 2022-07-24 23:39:00 -07:00
test_generator.py [3.10] gh-121650: Encode newlines in headers, and verify headers are sound (GH-122233) (#122609) 2024-09-04 17:38:31 +02:00
test_headerregistry.py bpo-43323: Fix UnicodeEncodeError in the email module (GH-32137) 2022-04-30 05:31:28 -07:00
test_inversion.py bpo-30681: Support invalid date format or value in email Date header (GH-22090) 2020-10-26 17:31:06 -07:00
test_message.py [3.10] Fix typos in the Lib directory (GH-28775) (GH-28804) 2021-10-07 11:49:47 -04:00
test_parser.py
test_pickleable.py
test_policy.py [3.10] gh-121650: Encode newlines in headers, and verify headers are sound (GH-122233) (#122609) 2024-09-04 17:38:31 +02:00
test_utils.py gh-95087: Fix IndexError in parsing invalid date in the email module (GH-95201) 2022-07-24 23:39:00 -07:00
torture_test.py