about summary refs log tree commit homepage
path: root/lib/PublicInbox/IMAPsearchqp.pm
DateCommit message (Collapse)
2023-02-13imap: quiet Parse::RecDescent errors on bad search queries
Parse::RecDescent emits giant errors to STDERR by default (bypassing $SIG{__WARN__}, even). Shut it up since there's no good way to pass those back to a client, and we don't want clients flooding logs with bogus requests.
2021-03-05search: use "z:" instead of "bytes:" prefix
So far, searching by size has never been publicly documented, and IMHO, of questionable utility. In any case, "z:" is what mairix(1) uses, so it may be familiar to existing mairix users (I've never used this prefix myself). So far, this prefix is only used internally in tests and in auto-translated queries from IMAP; thus this incompatible change is unlikely to affect anyone.
2021-01-14search: rename "ts:" prefix to "rt:"
Meaning "Received time", as it is the best description of the value we use from the "Received:" header, if present. JMAP calls it "receivedAt", but "rt:" seems like a better abbreviation being in line with "dt:" for the "Date" header. "Timestamp" ("ts") was potentially ambiguous given the presence of the "Date" header.
2021-01-01update copyrights for 2021
Using "make update-copyrights" after setting GNULIB_PATH in my config.mak
2020-08-30imapd: filter out unusable flags from search
Quiet down logs from -imapd when clients are blindly sending some unsupported flag conditions (e.g. "DRAFT", "DELETED") specified in RFC 3501.
2020-08-07imap: search support BODY key
This is specified in RFC 3501 but was accidentally omitted :x I probably got it confused with TEXT, so add a comment about TEXT being "everything" in the message.
2020-06-16imap: *SEARCH: reinstate "TEXT" search-key
I accidentally dropped "TEXT" handling while porting the IMAP search query parser to Parse::RecDescent. This reinstates it and adds a test to prevent future regression, and the additional test fixes a counting error for non-Xapian-enabled systems.
2020-06-16imap: *SEARCH: fix CHARSET handling
We no longer pass an arrayref to search_common() or parse_query(), so handle the CHARSET directive in the Parse::RecDescent-generated parser directly.
2020-06-16imap: *SEARCH: use Parse::RecDescent
For properly parsing IMAP search requests, it's easier to use a recursive descent parser generator to deal with subqueries and the "OR" statement. Parse::RecDescent was chosen since it's mature, well-known, widely available and already used by our optional dependencies: Inline::C and Mail::IMAPClient. While it's possible to build Xapian queries without using the Xapian string query parser; this iteration of the IMAP parser still builds a string which is passed to Xapian's query parser for ease-of-diagnostics. Since this is a recursive descent parser dealing with untrusted inputs, subqueries have a nesting limit of 10. I expect that is more than adequate for real-world use.