diff options
author | Barry Warsaw <barry@python.org> | 2007-03-14 04:29:06 +0000 |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2007-03-14 04:29:06 +0000 |
commit | 924d148b9826bd64fbcce046df6f5d967cf37bbe (patch) | |
tree | 5ebf076e10e78cacd1584a51ea58c9254e3381b4 /Lib/email/header.py | |
parent | 2a98ff8eedda81a222b9df63cc29a91ca23cfb54 (diff) | |
download | cpython-git-924d148b9826bd64fbcce046df6f5d967cf37bbe.tar.gz |
SF bug #1582282; decode_header() incorrectly splits not-conformant RFC
2047-like headers where there is no whitespace between encoded words. This
fix changes the matching regexp to include a trailing lookahead assertion that
the closing ?= must be followed by whitespace, newline, or end-of-string.
This also changes the regexp to add the MULTILINE flag.
Diffstat (limited to 'Lib/email/header.py')
-rw-r--r-- | Lib/email/header.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/email/header.py b/Lib/email/header.py index 183c337560..e139ccf64f 100644 --- a/Lib/email/header.py +++ b/Lib/email/header.py @@ -39,7 +39,8 @@ ecre = re.compile(r''' \? # literal ? (?P<encoded>.*?) # non-greedy up to the next ?= is the encoded string \?= # literal ?= - ''', re.VERBOSE | re.IGNORECASE) + (?=[ \t]|$) # whitespace or the end of the string + ''', re.VERBOSE | re.IGNORECASE | re.MULTILINE) # Field name regexp, including trailing colon, but not separating whitespace, # according to RFC 2822. Character range is from tilde to exclamation mark. |