This commit is contained in:
Balakrishnan Balasubramanian 2024-04-01 17:42:48 -04:00
parent d87025002a
commit ed8ff2728f
2 changed files with 7 additions and 6 deletions

View File

@ -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,9 +396,9 @@ 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))
asyncio.run(a_main("127.0.0.1", 1101, mails_path, users=users))
if __name__ == "__main__":

View File

@ -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: