diff options
author | Barry Warsaw <barry@python.org> | 2002-12-30 17:21:36 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2002-12-30 17:21:36 (GMT) |
commit | ba97659f5fedddac67587a0da94f486fd920cfb0 (patch) | |
tree | 8b54d0ef78e73508b633cc23be1255e8b2d27c46 /Lib | |
parent | 795833fbc6568a1aa45e912093a1a8788b107dc1 (diff) | |
download | cpython-ba97659f5fedddac67587a0da94f486fd920cfb0.zip cpython-ba97659f5fedddac67587a0da94f486fd920cfb0.tar.gz cpython-ba97659f5fedddac67587a0da94f486fd920cfb0.tar.bz2 |
parsedate_tz(): Fix SF bug #552345, optional FWS between the comma and
the day in an RFC 2822 date.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/email/_parseaddr.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/email/_parseaddr.py b/Lib/email/_parseaddr.py index a65cd6b..ef9423a 100644 --- a/Lib/email/_parseaddr.py +++ b/Lib/email/_parseaddr.py @@ -47,9 +47,16 @@ def parsedate_tz(data): Accounts for military timezones. """ data = data.split() - if data[0][-1] in (',', '.') or data[0].lower() in _daynames: + # The FWS after the comma after the day-of-week is optional, so search and + # adjust for this. + if data[0].endswith(',') or data[0].lower() in _daynames: # There's a dayname here. Skip it del data[0] + else: + i = data[0].rfind(',') + if i < 0: + return None + data[0] = data[0][i+1:] if len(data) == 3: # RFC 850 date, deprecated stuff = data[0].split('-') if len(stuff) == 3: |