This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: nntplib.NNTP.xover does not always return results as documented
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: dholm, georg.brandl
Priority: normal Keywords:

Created on 2013-01-30 19:16 by dholm, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg180987 - (view) Author: David Holm (dholm) Date: 2013-01-30 19:16
The response from NNTP.xover doesn't always match the format described in the documentation. It is supposed to return a (result, list) where the list contains entries of the format (article number, subject, poster, date, id, references, size, lines). However, I have found it to sometimes split the subject into two entries or only one of multiple references being in a list (see example below).

I am attempting to interpret the data using an enum-like structure to match the indices to the values but it fails very often because the date field contains part of the subject or the size field contains a cross reference entry.

Example using Python 2.7:

    >>> import nntplib
    >>> c = nntplib.NNTP(..)
    >>> c.group('alt.binaries.linux')
    ('211 317334 3 317336 alt.binaries.linux', '317334', '3', '317336', 'alt.binaries.linux')
    >>> resp, lst = c.xover('114179', '114179')
    >>> print resp
    224 data follows
    >>> print lst
    [('114179', 'Re: Newsposter - The Linux Binary Posting Script Version 7.2', 'Patriot <American1@shangri.la.org>', 'Mon, 04 Jan 2010 17:36:44 -0600', '<cu-dnfpXgcsR5t_WnZ2dnUVZ_rBi4p2d@giganews.com>', ['<5aydnT9obM20bKrWnZ2dnUVZ_v2dnZ2d@giganews.com>'], '<XGa0n.15891$0U1.11678@newsfe16.iad>', '1443')]

In the example above '<XGa0n.15891$0U1.11678@newsfe16.iad>' can be found at index 6 where the size is supposed to be.
msg199812 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2013-10-13 21:47
The NNTP server seems to be violating the protocol; it is supposed to convert tab characters in the fields to spaces.  It appears that in your example the list of references was separated by a tab character, which Python then (correctly) interprets as separator.
History
Date User Action Args
2022-04-11 14:57:41adminsetgithub: 61286
2013-10-13 21:47:08georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg199812

resolution: not a bug
2013-01-30 19:16:53dholmcreate