Merge: #16983: Apply postel's law to encoded words inside quoted strings.

This commit is contained in:
R David Murray 2014-02-08 13:13:01 -05:00
commit 01e46ee7e2
4 changed files with 29 additions and 0 deletions

View file

@ -1556,6 +1556,13 @@ def get_bare_quoted_string(value):
while value and value[0] != '"':
if value[0] in WSP:
token, value = get_fws(value)
elif value[:2] == '=?':
try:
token, value = get_encoded_word(value)
bare_quoted_string.defects.append(errors.InvalidHeaderDefect(
"encoded word inside quoted string"))
except errors.HeaderParseError:
token, value = get_qcontent(value)
else:
token, value = get_qcontent(value)
bare_quoted_string.append(token)