mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #10281: nntplib now returns None for absent fields in the OVER/XOVER
response, instead of raising an exception.
This commit is contained in:
parent
33d144aa36
commit
4103bc09a4
4 changed files with 35 additions and 4 deletions
|
@ -205,11 +205,12 @@ def _parse_overview(lines, fmt, data_process_func=None):
|
|||
is_metadata = field_name.startswith(':')
|
||||
if i >= n_defaults and not is_metadata:
|
||||
# Non-default header names are included in full in the response
|
||||
h = field_name + ":"
|
||||
if token[:len(h)].lower() != h:
|
||||
# (unless the field is totally empty)
|
||||
h = field_name + ": "
|
||||
if token and token[:len(h)].lower() != h:
|
||||
raise NNTPDataError("OVER/XOVER response doesn't include "
|
||||
"names of additional headers")
|
||||
token = token[len(h):].lstrip(" ")
|
||||
token = token[len(h):] if token else None
|
||||
fields[fmt[i]] = token
|
||||
overview.append((article_number, fields))
|
||||
return overview
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue