emersion / go-imap

📥 An IMAP library for clients and servers
MIT License
2.1k stars 297 forks source link

in response: imapwire: expected CRLF, got " " #540

Closed k773 closed 1 year ago

k773 commented 1 year ago

Code to reproduce:

func TestOutlook(t *testing.T) {
    client, e := imapclient.DialTLS("outlook.office365.com:993", &imapclient.Options{DebugWriter: os.Stderr})
    if e != nil {
        panic(e)
    }
    if e = client.Login(username, password).Wait(); e != nil {
        panic(e)
    }
    if _, e = client.Select("INBOX", nil).Wait(); e != nil {
        panic(e)
    }
    if _, e = client.Status("INBOX", &imap.StatusOptions{NumMessages: true}).Wait(); e != nil {
        panic(e)  // <- panics here
    }
}

This code produces the following error:

panic: in response: imapwire: expected CRLF, got " " [recovered]
    panic: in response: imapwire: expected CRLF, got " "

From the debug output I can see that there is a space symbol after the ')' (second line), which go-imap does not expect:

T5 STATUS INBOX (MESSAGES)
* STATUS Inbox (MESSAGES 1) 
T5 OK STATUS completed.
emersion commented 1 year ago

Does https://github.com/emersion/go-imap/pull/541 help?

k773 commented 1 year ago

Yes, it does. Thank you.