implement IMAP extension COMPRESS=DEFLATE, rfc 4978

to compress the entire IMAP connection. tested with thunderbird, meli, k9, ios
mail. the initial implementation had interoperability issues with some of these
clients: if they write the deflate stream and flush in "partial mode", the go
stdlib flate reader does not return any data (until there is an explicit
zero-length "sync flush" block, or until the history/sliding window is full),
blocking progress, resulting in clients closing the seemingly stuck connection
after considering the connection timed out. this includes a coy of the flate
package with a new reader that returns partially flushed blocks earlier.

this also adds imap trace logging to imapclient.Conn, which was useful for
debugging.
This commit is contained in:
Mechiel Lukkien
2025-02-20 19:33:09 +01:00
parent 3f6c45a41f
commit f40f94670e
25 changed files with 3623 additions and 69 deletions

View File

@ -189,7 +189,7 @@ https://www.iana.org/assignments/message-headers/message-headers.xhtml
4551 Yes Obs (RFC 7162) IMAP Extension for Conditional STORE Operation or Quick Flag Changes Resynchronization
4731 Yes - IMAP4 Extension to SEARCH Command for Controlling What Kind of Information Is Returned
4959 Yes - IMAP Extension for Simple Authentication and Security Layer (SASL) Initial Client Response
4978 Roadmap - The IMAP COMPRESS Extension
4978 Yes - The IMAP COMPRESS Extension
5032 Yes - WITHIN Search Extension to the IMAP Protocol
5092 Roadmap - IMAP URL Scheme
5161 Yes - The IMAP ENABLE Extension