duesee/imap-next

Change `max_literal_size` to `max_append_literal_size`

Opened this issue · 2 comments

Currently ServerFlowOptions::max_literal_size is applied to all literals. However, this might not reflect how it will be used in practice:

  • The most relevant use-case for max literal size is the APPEND command
  • Besides that it would be better to reject literals and commands based on a smaller limit

Idea:

  • Change max_literal_size to max_append_literal_size and use it only for APPEND literals
  • max_command_size (introduced in #153) should not apply to APPEND commands

How can we detect an APPEND command? We can't decode the full command because we didn't receive all bytes yet.

Maybe the imap-codec crate could add another method to Fragmentizer for that, similar to Fragmentizer::decode_tag. I would prefer to leave any byte parsing to the imap-codec crate.

I'm not sure anymore if we want to have this distinction. Maybe max_message_size is all we need, actually... APPEND is special, but... Let's talk again soon.