[issue28971] nntplib is broken when responses are longer than _MAXLINE

Martin Panter report at bugs.python.org
Sat Dec 17 22:50:02 EST 2016


Martin Panter added the comment:

The first offending message I found is number 183465:

>>> s.group("comp.lang.python")
('211 4329 179178 183507 comp.lang.python', 4329, 179178, 183507, 'comp.lang.python')
>>> s._putcmd("OVER 183465")
>>> s._getresp()
'224 Overview information for 183465 follows'
>>> line = s.file.readline()
>>> len(line)
2702
>>> [number, subject, from_header, date, message_id, references, bytes, lines, extra] = line.split(b"\t", 8)
>>> message_id
b'<mailman.122.1481898601.2322.python-list at python.org>'
>>> len(references)
2483
>>> len(references.split())
36

Assuming the References value is the only large field in an OVER response line, I would guess that a reasonable limit per line might be

200 bytes/message-id * 200 messages/thread = 40,000 bytes per OVER line

I agree with closing the session whenever the client’s protocol state is broken, but only for a different, tangential reason. See Issue 22350. Even if you raised an explicit exception when using a closed session, like in nntplib_maxbytes.patch, won’t that still cause the subsequent tests to fail? I think the best solution is to stop sharing one connection across multiple tests: Issue 19756.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28971>
_______________________________________


More information about the Python-bugs-list mailing list