mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Issue 5949: fixed IMAP4_SSL hang when the IMAP server response is
missing proper end-of-line termination. Patch and tests by Scott Dial. The new tests include a test harness which will make it easier to add additional tests.
This commit is contained in:
parent
29dcdabf40
commit
93321f333c
3 changed files with 170 additions and 4 deletions
|
@ -1001,6 +1001,8 @@ class IMAP4:
|
|||
raise self.abort('socket error: EOF')
|
||||
|
||||
# Protocol mandates all lines terminated by CRLF
|
||||
if not line.endswith('\r\n'):
|
||||
raise self.abort('socket error: unterminated line')
|
||||
|
||||
line = line[:-2]
|
||||
if __debug__:
|
||||
|
@ -1167,7 +1169,7 @@ else:
|
|||
while 1:
|
||||
char = self.sslobj.read(1)
|
||||
line.append(char)
|
||||
if char == "\n": return ''.join(line)
|
||||
if char in ("\n", ""): return ''.join(line)
|
||||
|
||||
|
||||
def send(self, data):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue