Message96180
It seems that on the py3k branch, the EOF situation is handled roughly
in the same manner (the broken line is returned) and ultimately the
IMAP4.abort exception is raised because b'* ' is an invalid response
(the 'OK' having been dropped). IOW, it passes the EOF test only because
trimming broke the welcome message format. If it got an EOF in the
middle of a more complicated response, it would go undetected or cause a
broken response.
I propose adding the following test case:
@reap_threads
def test_line_termination(self):
class BadNewlineHandler(SimpleIMAPHandler):
def cmd_CAPABILITY(self, tag, args):
self._send(b'* CAPABILITY IMAP4rev1 AUTH\n')
self._send('{} OK CAPABILITY
completed\r\n'.format(tag).encode('ASCII'))
with self.reaped_server(BadNewlineHandler) as server:
self.assertRaises(imaplib.IMAP4.abort,
self.imap_class, *server.server_address)
Which silently misreads the CAPABILITY response as including "AUT" and
not "AUTH". It would be a perversely broken server, but I think this
test case demonstrates why an explicit check and exception should be
thrown always. |
|
Date |
User |
Action |
Args |
2009-12-09 19:49:13 | scott.dial | set | recipients:
+ scott.dial, barry, rhettinger, ncoghlan, janssen, kevinwatters, benjamin.peterson, r.david.murray, rmore, rtucker |
2009-12-09 19:49:13 | scott.dial | set | messageid: <1260388153.68.0.204484005046.issue5949@psf.upfronthosting.co.za> |
2009-12-09 19:49:12 | scott.dial | link | issue5949 messages |
2009-12-09 19:49:12 | scott.dial | create | |
|