diff options
author | Eric Wong <e@80x24.org> | 2022-08-08 23:16:47 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2022-08-09 16:41:49 +0000 |
commit | 6bfbb1d477d1adf40fa15a9f6e326f01cf966fc9 (patch) | |
tree | 56dcd892a1301c85c66539317a7e83828877d38e /lib/PublicInbox/IMAP.pm | |
parent | 42fe10a95f0bac3beea2fc277c604158d3275d1f (diff) | |
download | public-inbox-6bfbb1d477d1adf40fa15a9f6e326f01cf966fc9.tar.gz |
...by deprioritizing clients using a username + password. As IMAP provides AUTH=ANONYMOUS for designating anonymous access, we'll rely on it as a heuristic for favoring "good" clients. Clients using a username + password seem to (more often than not) be malicious and looking for info which doesn't belong in public inboxes. This copies the technique used by WWW + -httpd to deprioritize expensive mbox.gz downloads.
Diffstat (limited to 'lib/PublicInbox/IMAP.pm')
-rw-r--r-- | lib/PublicInbox/IMAP.pm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm index 4ef5252b..605c5e51 100644 --- a/lib/PublicInbox/IMAP.pm +++ b/lib/PublicInbox/IMAP.pm @@ -575,6 +575,16 @@ sub fetch_run_ops { $self->msg_more(")\r\n"); } +sub requeue { # overrides PublicInbox::DS::requeue + my ($self) = @_; + if ($self->{anon}) { # AUTH=ANONYMOUS gets high priority + $self->SUPER::requeue; + } else { # low priority + push(@{$self->{imapd}->{-authed_q}}, $self) == 1 and + PublicInbox::DS::requeue($self->{imapd}); + } +} + sub fetch_blob_cb { # called by git->cat_async via ibx_async_cat my ($bref, $oid, $type, $size, $fetch_arg) = @_; my ($self, undef, $msgs, $range_info, $ops, $partial) = @$fetch_arg; |