emersion / go-imap

📥 An IMAP library for clients and servers
MIT License
2.02k stars 288 forks source link

v2 DebugWriter breaks LOGIN or any imap command #581

Closed resolutecake closed 5 months ago

resolutecake commented 6 months ago

this is because:

Now Flush will always fail meaning the first command is sent out and then "short write" error occurs bufio.Writer.Flush

Multiple buffered wrapping does not work in Go

version: 0196200 12/26/2023

resolutecake commented 6 months ago

Actually, the root cause was that my debug writer did not update sent bytes, returns n int This causes the short write. If the debug writer fails, this error is indistinguishable from a communications failure

emersion commented 5 months ago

This is expected behavior. If the debug writer fails, it's normal for go-imap to return an error.