From cc4ecf2927261a2d7bb828271e525829deb1d2a7 Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Mon, 24 Jul 2023 19:54:55 +0200 Subject: [PATCH] imap continuations must have a space after the "+" prevented at least the gmail/mail (?) android app from appending a sent message to the sent mailbox. --- imapserver/authenticate_test.go | 2 +- imapserver/idle_test.go | 2 +- imapserver/server.go | 4 ++-- imapserver/server_test.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/imapserver/authenticate_test.go b/imapserver/authenticate_test.go index 15c8b15..8180cc7 100644 --- a/imapserver/authenticate_test.go +++ b/imapserver/authenticate_test.go @@ -54,7 +54,7 @@ func TestAuthenticatePlain(t *testing.T) { tc.readstatus("bad") tc.cmdf("", "authenticate plain") - tc.readprefixline("+") + tc.readprefixline("+ ") tc.writelinef("%s", base64.StdEncoding.EncodeToString([]byte("\u0000mjl@mox.example\u0000testtest"))) tc.readstatus("ok") } diff --git a/imapserver/idle_test.go b/imapserver/idle_test.go index 6c16ee9..b1854b3 100644 --- a/imapserver/idle_test.go +++ b/imapserver/idle_test.go @@ -23,7 +23,7 @@ func TestIdle(t *testing.T) { // todo: test with delivery through smtp tc2.cmdf("", "idle") - tc2.readprefixline("+") + tc2.readprefixline("+ ") done := make(chan error) go func() { defer func() { diff --git a/imapserver/server.go b/imapserver/server.go index 595da18..47f9395 100644 --- a/imapserver/server.go +++ b/imapserver/server.go @@ -566,7 +566,7 @@ func (c *conn) readCommand(tag *string) (cmd string, p *parser) { func (c *conn) xreadliteral(size int64, sync bool) string { if sync { - c.writelinef("+") + c.writelinef("+ ") } buf := make([]byte, size) if size > 0 { @@ -2541,7 +2541,7 @@ func (c *conn) cmdAppend(tag, cmd string, p *parser) { c.xmailbox(tx, name, "TRYCREATE") }) if sync { - c.writelinef("+") + c.writelinef("+ ") } // Read the message into a temporary file. diff --git a/imapserver/server_test.go b/imapserver/server_test.go index a7edf56..56964e6 100644 --- a/imapserver/server_test.go +++ b/imapserver/server_test.go @@ -512,7 +512,7 @@ func TestScenario(t *testing.T) { tc.transactf("ok", "append inbox (\\seen) {%d+}\r\n%s", len(exampleMsg), exampleMsg) tc.transactf("no", "append bogus () {%d}", len(exampleMsg)) tc.cmdf("", "append inbox () {%d}", len(exampleMsg)) - tc.readprefixline("+") + tc.readprefixline("+ ") _, err := tc.conn.Write([]byte(exampleMsg + "\r\n")) tc.check(err, "write message") tc.response("ok")