in imap4rev1 search, always send an untagged search response, also without matches

required by rfc. i noticed an example doing that in the condstore/qresync rfc.
This commit is contained in:
Mechiel Lukkien 2023-07-24 15:40:04 +02:00
parent bca33c0364
commit bc62aae0e6
No known key found for this signature in database
2 changed files with 5 additions and 4 deletions

View file

@ -128,6 +128,11 @@ func (c *conn) cmdxSearch(isUID bool, tag, cmd string, p *parser) {
}) })
if eargs == nil { if eargs == nil {
// In IMAP4rev1, an untagged SEARCH response is required. ../rfc/3501:2728
if len(uids) == 0 {
c.bwritelinef("* SEARCH")
}
// Old-style SEARCH response. We must spell out each number. So we may be splitting // Old-style SEARCH response. We must spell out each number. So we may be splitting
// into multiple responses. ../rfc/9051:6809 ../rfc/3501:4833 // into multiple responses. ../rfc/9051:6809 ../rfc/3501:4833
for len(uids) > 0 { for len(uids) > 0 {

View file

@ -36,10 +36,6 @@ this is html.
func (tc *testconn) xsearch(nums ...uint32) { func (tc *testconn) xsearch(nums ...uint32) {
tc.t.Helper() tc.t.Helper()
if len(nums) == 0 {
tc.xnountagged()
return
}
tc.xuntagged(imapclient.UntaggedSearch(nums)) tc.xuntagged(imapclient.UntaggedSearch(nums))
} }