-
Notifications
You must be signed in to change notification settings - Fork 330
imapserver: advertise APPENDLIMIT capability #692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v2
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this implements only part of APPENDLIMIT
: this is missing the STATUS extension.
// DiscloseLimit indicates whether the limit should be advertised in the CAPABILITY | ||
// response. If false, only "APPENDLIMIT" will be listed, without the actual limit. | ||
// If true, "APPENDLIMIT=<limit>" will be listed. | ||
DiscloseLimit() bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this method? Servers can already reject literals which are too large in APPEND without advertising a limit (by returning an error).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
APPENDLIMIT capability can be advertised as APPENDLIMIT only or with explicit limit APPENDLIMIT=. In first you have to try to discover the limit while in the second you know before you try. The method allows to server to configure whether it will advertise it or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I'm not sure I'm following. If APPENDLIMIT is listed in Caps
, then we already know that the server wants to disclose the limit?
How about the following:
- If
AppendLimit
is not listed inCaps
, never advertiseAppendLimit
- If
AppendLimit
is listed inCaps
:- If
SessionAppendLimit
is implemented and returns a non-zero value, advertiseAPPENDLIMIT=n
- Otherwise, advertise
APPENDLIMIT
without a value
- If
} else { | ||
caps = append(caps, imap.CapAppendLimit) | ||
} | ||
} else if limit, ok := available.AppendLimit(); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds two ways to set the global limit, either with a SessionAppendLimit
, either with manual string formatting in Caps
. I'd prefer to keep only the former.
// Capabilities which require backend support and apply to both | ||
// IMAP4rev1 and IMAP4rev2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep this comment next to the addAvailableCaps
list below?
@@ -86,6 +88,21 @@ func (c *Conn) availableCaps() []imap.Cap { | |||
|
|||
// Capabilities which require backend support and apply to both | |||
// IMAP4rev1 and IMAP4rev2 | |||
if appendLimitSession, ok := c.session.(SessionAppendLimit); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per the RFC, we should only advertise a limit in the authenticated state.
} | ||
|
||
// NewUserSessionWithAppendLimit creates a new user session with a custom append limit. | ||
func NewUserSessionWithAppendLimit(user *User, appendLimit uint32, discloseLimit bool) *UserSession { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we keep this simple and only have a single global append limit in imapmemserver?
No description provided.