diff options
-rw-r--r-- | Lib/email/FeedParser.py | 4 | ||||
-rw-r--r-- | Lib/email/test/test_email.py | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/Lib/email/FeedParser.py b/Lib/email/FeedParser.py index 5aad15d..a2130e2 100644 --- a/Lib/email/FeedParser.py +++ b/Lib/email/FeedParser.py @@ -1,4 +1,4 @@ -# Copyright (C) 2004 Python Software Foundation +# Copyright (C) 2004-2006 Python Software Foundation # Authors: Baxter, Wouters and Warsaw # Contact: email-sig@python.org @@ -29,7 +29,7 @@ NLCRE_eol = re.compile('(\r\n|\r|\n)$') NLCRE_crack = re.compile('(\r\n|\r|\n)') # RFC 2822 $3.6.8 Optional fields. ftext is %d33-57 / %d59-126, Any character # except controls, SP, and ":". -headerRE = re.compile(r'^(From |[\041-\071\073-\176]{2,}:|[\t ])') +headerRE = re.compile(r'^(From |[\041-\071\073-\176]{1,}:|[\t ])') EMPTYSTRING = '' NL = '\n' diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py index c78e2fd..c22603d 100644 --- a/Lib/email/test/test_email.py +++ b/Lib/email/test/test_email.py @@ -2467,6 +2467,15 @@ Here's the message body msg = email.message_from_string(m) eq(len(msg.keys()), 0) + def test_rfc2822_one_character_header(self): + eq = self.assertEqual + m = 'A: first header\nB: second header\nCC: third header\n\nbody' + msg = email.message_from_string(m) + headers = msg.keys() + headers.sort() + eq(headers, ['A', 'B', 'CC']) + eq(msg.get_payload(), 'body') + class TestBase64(unittest.TestCase): |