mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
parsedate_tz(): Fix SF bug #552345, optional FWS between the comma and
the day in an RFC 2822 date.
This commit is contained in:
parent
795833fbc6
commit
ba97659f5f
1 changed files with 8 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue