diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-11-03 18:18:43 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-11-03 18:18:43 (GMT) |
commit | 4103bc09a4326a4ffd8d2dbc60a01d256d18b1f7 (patch) | |
tree | a5d8a116d3ebb5ec2a42bf6f55a6156bd168fd62 /Lib/nntplib.py | |
parent | 33d144aa36ee8afb2f9a8c0b081e6f24591106ab (diff) | |
download | cpython-4103bc09a4326a4ffd8d2dbc60a01d256d18b1f7.zip cpython-4103bc09a4326a4ffd8d2dbc60a01d256d18b1f7.tar.gz cpython-4103bc09a4326a4ffd8d2dbc60a01d256d18b1f7.tar.bz2 |
Issue #10281: nntplib now returns None for absent fields in the OVER/XOVER
response, instead of raising an exception.
Diffstat (limited to 'Lib/nntplib.py')
-rw-r--r-- | Lib/nntplib.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/nntplib.py b/Lib/nntplib.py index b067d6b..fde339a 100644 --- a/Lib/nntplib.py +++ b/Lib/nntplib.py @@ -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 |