mirror of
https://github.com/python/cpython.git
synced 2025-10-07 07:31:46 +00:00
bpo-29412: Fix indexError when parsing a header value ending unexpectedly (GH-14387)
* patched string index out of range error in get_word function of _header_value_parser.py and created tests in test__header_value_parser.py for CFWS. * Raise HeaderParseError instead of continuing when parsing a word.
This commit is contained in:
parent
2a7d596f27
commit
7213df7bbf
3 changed files with 22 additions and 0 deletions
|
@ -1360,6 +1360,9 @@ def get_word(value):
|
|||
leader, value = get_cfws(value)
|
||||
else:
|
||||
leader = None
|
||||
if not value:
|
||||
raise errors.HeaderParseError(
|
||||
"Expected 'atom' or 'quoted-string' but found nothing.")
|
||||
if value[0]=='"':
|
||||
token, value = get_quoted_string(value)
|
||||
elif value[0] in SPECIALS:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue