about summary refs log tree commit homepage
path: root/lib/PublicInbox/POP3.pm
DateCommit message (Collapse)
2023-11-01pop3: use SSL_shutdown(3ssl) if appropriate
This allows us support SSL session caching + reuse in the future.
2023-09-22pop3: support initial_limit parameter in mailbox name
`initial_limit' only affects the fetch for new users while `limit' affects all users. `initial_limit' is intended to be better than the existing, absolute `limit' for 24/7 servers (e.g. scheduled POP3 imports via webmail). The existing `limit' parameter remains and is best suited for systems with sporadic Internet access. This also fixes an offset calculation bug with limit when used on the newest (non-full) slice. The number of messages in the newest slice is now taken into account. Link: https://public-inbox.org/meta/20230918-barrel-unhearing-b63869@meerkat/ Fixes: 392d251f97d4 (pop3: support `?limit=$NUM' parameter in mailbox name)
2023-09-15pop3: limit default mailbox to 1K messages
This is probably friendlier to webmail providers which support importing mail from POP3.
2023-09-15pop3: support `?limit=$NUM' parameter in mailbox name
I'm not sure if `?' or `=' are allowed characters in POP3 mailbox names. In fact, I can't find any information on valid characters allowed in RFC 1081 nor RFC 1939. In any case, it works fine with mpop, Claws-Mail, and Thunderbird. Tested-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
2023-05-02daemon: improve handling of Git->async_abort
The $oid arg for Git->cat_async is defined on async_abort using the original request, so use undefined $type to distinguish that case in caller-supplied callbacks. async_abort isn't common, of course, but sometimes git subprocesses can die unexpectedly.
2022-08-16pop3: speed up STAT slightly (~1%)
We can calculate the total size of the mailbox while generating the cache, which allows us to iterate the cache again to calculate the size of the mailbox slice. While we're in the area, simplify the loop and avoid needlessly updating the `$beg' variable. This adds a small amount of constant time overhead to DELE, however that is amortized across multiple requests for fairness.
2022-08-12pop3: fix off-by-one error when handling `EXPIRE 0'
mark_dele already works on the cache offset, so there's no need to make further adjustments to the offset (as we do with POP3 sequence numbers).
2022-08-12pop3: quiet warning for cached active statements
Setting the $if_active parameter of ->prepare_cached to `1' seemed to be the best option many years ago, so it's probably the best option going forward when caching prepared statements. Fixes: cab36ebd00ca72f8 ("pop3: remove untouched rows on QUIT/disconnect")
2022-08-10daemon: rely on $SIG{__WARN__} for error output
warn/carp usage is unavoidable given Perl itself and standard libraries, so just rely on localized $SIG{__WARN__} from 60d262483a4d6ddf (daemon: use per-listener SIG{__WARN__} callbacks, 2022-08-08) for all error reporting. While we're in the area, make some of the error handling more consistent between IMAP/NNTP/POP3.
2022-08-10pop3: remove untouched rows on QUIT/disconnect
Some POP3 clients may connect and never retrieve messages nor trigger deletes. In that case, save some storage by removing unused rows from the `deletes' and `users' tables.
2022-08-09daemon: use per-listener SIG{__WARN__} callbacks
This allows "-l $ADDRESS?err=/path/to/err.log to isolate normal warn() (and carp()) messages for a particular listen address to track down errors more easily.
2022-08-03daemon: reload TLS certs and keys on SIGHUP
This allows new TLS certificates to be loaded for new clients without having to timeout nor drop existing clients with established connections made with the old certs. This should benefit users with admins who expire certificates frequently (as encouraged by Let's Encrypt).
2022-07-23pop3: reduce memory use while generating the mailbox cache
While the cache itself is relatively compact for 50K messages, generating it was inefficient due to our schema and Over.pm APIs being designed for NNTP. While we won't change our schema for now, we can choose better DBI APIs to use and limit our ephemeral memory use. This amounts to a 60% reduction in memory usage and a 5-10% speedup against org.kernel.vger.git.0: { echo 'USER '$(uuidgen)'@org.kernel.vger.git.0' echo PASS anonymous echo STAT echo QUIT } | nc $HOST $PORT
2022-07-23ds: share long_step between NNTP and IMAP
It's not actually used by our POP3 code at the moment, but it may be soon to reduce memory usage when loading 50K smsg objects into memory.
2022-07-23ds: move requeue_once
It's the same subroutine everywhere.
2022-07-23ds: move no-op ->zflush to common base class
More deduplication, and POP3 never needed it.
2022-07-23ds: support greeting protocols
We can share some common code between IMAP, NNTP, and POP3 without too much trouble, so cut down our LoC.
2022-07-20pop3: advertise STLS in CAPA if appropriate
This is documented in RFC 2595, and POP3 clients may rely on seeing "STLS" in CAPA output to initiate TLS negotiation.
2022-07-20pop3: TOP requests do not expire messages
RFC 2449 only documents "EXPIRE 0" behavior for RETR requests which fetch the whole message. TOP requests only fetch the headers and top $N lines of the body, so it's probably harmful for deletions to be triggered in those cases.
2022-07-20pop3: implement IN-USE from RESP-CODES (RFC 2449)
This may help clients communicate to users if they're making parallel connections or if we have server bugs.
2022-07-20public-inbox-pop3d - a mostly read-only POP3 server
Old account expiry has not been implemented, but it seems to work well with both mpop(1) and getmail(1). The strictness of mpop was particularly helpful in ironing out bugs in our implementation of (dreaded) message sequence numbers. "EXPIRE 0" (RFC 2449) can theoretically save numerous "DELE" commands, but that's untested by real-world clients. mpop supports PIPELINING which is effective in hiding latency, and the core networking functionality is already well-tested from our NNTP and IMAP implementations. Configuration requires "publicinbox.pop3state" to point to a directory writable by the otherwise read-only daemon. See public-inbox-pop3d(1) manpage for more usage details.