pop3 should byte-stuff lines starting with dot #5
@@ -219,8 +219,8 @@ def trans_command_retr(mails: MailList, req: Request) -> None:
 | 
			
		||||
        write(ok("Contents follow"))
 | 
			
		||||
        with get_mail_fp(entry) as fp:
 | 
			
		||||
            for line in fp:
 | 
			
		||||
                if line.startswith(b'.'):
 | 
			
		||||
                    write(b'.') # prepend dot
 | 
			
		||||
                if line.startswith(b"."):
 | 
			
		||||
                    write(b".")  # prepend dot
 | 
			
		||||
                write(line)
 | 
			
		||||
        # write(get_mail(entry)) # no prepend dot
 | 
			
		||||
        write(end())
 | 
			
		||||
@@ -396,7 +396,7 @@ def debug_main():
 | 
			
		||||
    _, mails_path, mbox = sys.argv
 | 
			
		||||
 | 
			
		||||
    mails_path = Path(mails_path)
 | 
			
		||||
    users = [ User(username="dummy", password_hash=gen_pwhash("dummy"), mbox=mbox) ]
 | 
			
		||||
    users = [User(username="dummy", password_hash=gen_pwhash("dummy"), mbox=mbox)]
 | 
			
		||||
 | 
			
		||||
    asyncio.run(a_main("127.0.0.1", 1101, mails_path, users=users))
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -218,14 +218,15 @@ class TestPop3(unittest.IsolatedAsyncioTestCase):
 | 
			
		||||
            pc = poplib.POP3("127.0.0.1", 7995)
 | 
			
		||||
            try:
 | 
			
		||||
                self.assertEqual(b"+OK Server Ready", pc.getwelcome())
 | 
			
		||||
                self.assertEqual(b'+OK Welcome', pc.user("foo2"))
 | 
			
		||||
                self.assertEqual(b'+OK Login successful', pc.pass_("helloworld"))
 | 
			
		||||
                self.assertEqual(b"+OK Welcome", pc.user("foo2"))
 | 
			
		||||
                self.assertEqual(b"+OK Login successful", pc.pass_("helloworld"))
 | 
			
		||||
                _, eml, oc = pc.retr(1)
 | 
			
		||||
                self.assertIn(b"Previous line just has a dot", eml)
 | 
			
		||||
                self.assertIn(b".Line starts with a dot", eml)
 | 
			
		||||
                self.assertIn(b".", eml)
 | 
			
		||||
            finally:
 | 
			
		||||
                pc.quit()
 | 
			
		||||
 | 
			
		||||
        await asyncio.to_thread(run_poplib)
 | 
			
		||||
 | 
			
		||||
    async def asyncTearDown(self) -> None:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user