mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
merge with 3.3
This commit is contained in:
commit
b89b5df9c9
13 changed files with 191 additions and 38 deletions
|
@ -85,6 +85,13 @@ __all__ = ["NNTP",
|
|||
"decode_header",
|
||||
]
|
||||
|
||||
# maximal line length when calling readline(). This is to prevent
|
||||
# reading arbitrary lenght lines. RFC 3977 limits NNTP line length to
|
||||
# 512 characters, including CRLF. We have selected 2048 just to be on
|
||||
# the safe side.
|
||||
_MAXLINE = 2048
|
||||
|
||||
|
||||
# Exceptions raised when an error or invalid response is received
|
||||
class NNTPError(Exception):
|
||||
"""Base class for all nntplib exceptions"""
|
||||
|
@ -424,7 +431,9 @@ class _NNTPBase:
|
|||
"""Internal: return one line from the server, stripping _CRLF.
|
||||
Raise EOFError if the connection is closed.
|
||||
Returns a bytes object."""
|
||||
line = self.file.readline()
|
||||
line = self.file.readline(_MAXLINE +1)
|
||||
if len(line) > _MAXLINE:
|
||||
raise NNTPDataError('line too long')
|
||||
if self.debugging > 1:
|
||||
print('*get*', repr(line))
|
||||
if not line: raise EOFError
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue