user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* Re: [RFC] pop3: support `?limit=$NUM' parameter in mailbox name
  2023-09-18 13:46  0%           ` Konstantin Ryabitsev
@ 2023-09-18 21:14  0%             ` Eric Wong
  0 siblings, 0 replies; 4+ results
From: Eric Wong @ 2023-09-18 21:14 UTC (permalink / raw)
  To: Konstantin Ryabitsev; +Cc: meta

Konstantin Ryabitsev <konstantin@linuxfoundation.org> wrote:
> On Fri, Sep 15, 2023 at 08:41:10PM +0000, Eric Wong wrote:
> > Thanks, pushed the series as
> > a37e3ab3740c24c3 (pop3: limit default mailbox to 1K messages, 2023-09-14)
> > 392d251f97d46579 (pop3: support `?limit=$NUM' parameter in mailbox name, 2023-09-12)
> 
> Oh, I did notice what is probably unintentional behaviour -- passing
> ?limit=XXX affects all mailbox access, not just the initial retrieval.
> 
> E.g. if I configured pop3 with ?limit=128, then leave for the weekend and
> return on Monday, I will only be able to retrieve 128 new messages, regardless
> of how many arrived over the weekend.
> 
> I'm not sure if this is what was intended -- I think it makes more sense to
> have ?limit=XXX only affect the initial retrieval. In all other cases, when a
> tracking uuid cookie is present, it should return all messages regardless of
> ?limit=.
> 
> Does that make sense?

I think there should be an initial_limit parameter in addition to the
current limit.   initial_limit would be more suited for cronjobs and
such running on 24/7 systems.  The regular limit would be better
for systems with intermittent access and could go weeks w/o being
online (including situations where somebody restored a system from
a months/years-old backup).

Not feeling well, will try to work on it once (or if) I feel better.

^ permalink raw reply	[relevance 0%]

* Re: [RFC] pop3: support `?limit=$NUM' parameter in mailbox name
  2023-09-15 20:41  7%         ` Eric Wong
@ 2023-09-18 13:46  0%           ` Konstantin Ryabitsev
  2023-09-18 21:14  0%             ` Eric Wong
  0 siblings, 1 reply; 4+ results
From: Konstantin Ryabitsev @ 2023-09-18 13:46 UTC (permalink / raw)
  To: Eric Wong; +Cc: meta

On Fri, Sep 15, 2023 at 08:41:10PM +0000, Eric Wong wrote:
> Thanks, pushed the series as
> a37e3ab3740c24c3 (pop3: limit default mailbox to 1K messages, 2023-09-14)
> 392d251f97d46579 (pop3: support `?limit=$NUM' parameter in mailbox name, 2023-09-12)

Oh, I did notice what is probably unintentional behaviour -- passing
?limit=XXX affects all mailbox access, not just the initial retrieval.

E.g. if I configured pop3 with ?limit=128, then leave for the weekend and
return on Monday, I will only be able to retrieve 128 new messages, regardless
of how many arrived over the weekend.

I'm not sure if this is what was intended -- I think it makes more sense to
have ?limit=XXX only affect the initial retrieval. In all other cases, when a
tracking uuid cookie is present, it should return all messages regardless of
?limit=.

Does that make sense?

-K

^ permalink raw reply	[relevance 0%]

* Re: [RFC] pop3: support `?limit=$NUM' parameter in mailbox name
  @ 2023-09-15 20:41  7%         ` Eric Wong
  2023-09-18 13:46  0%           ` Konstantin Ryabitsev
  0 siblings, 1 reply; 4+ results
From: Eric Wong @ 2023-09-15 20:41 UTC (permalink / raw)
  To: Konstantin Ryabitsev; +Cc: meta

Konstantin Ryabitsev <konstantin@linuxfoundation.org> wrote:
> Tested-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>

Thanks, pushed the series as
a37e3ab3740c24c3 (pop3: limit default mailbox to 1K messages, 2023-09-14)
392d251f97d46579 (pop3: support `?limit=$NUM' parameter in mailbox name, 2023-09-12)

^ permalink raw reply	[relevance 7%]

* Re: [RFC] pop3: support `?limit=$NUM' parameter in mailbox name
  @ 2023-09-14  0:38  7%     ` Eric Wong
    0 siblings, 1 reply; 4+ results
From: Eric Wong @ 2023-09-14  0:38 UTC (permalink / raw)
  To: Konstantin Ryabitsev; +Cc: meta

Konstantin Ryabitsev <konstantin@linuxfoundation.org> wrote:
> On Tue, Sep 12, 2023 at 10:40:34PM +0000, Eric Wong wrote:
> > Perhaps 50K is too much?  I figured clients would have a way to
> > limit that, but I don't really pay attention to POP3 clients...
> 
> The few clients I looked at didn't give any option to specify how many remote
> messages I want to retrieve, so I think defaulting to 50,000 is not the right
> approach. Maybe the default limit should be something "last 7 days or 1000
> messages, whichever is larger"?

OK, 1K (or any other fixed limit) is fine and easiest.  7 days
(or any other time window) could get flooded if there's a nasty
spike of some sort.

> My initial target for deploying POP3 support is to allow Gmail users to
> pull-subscribe to mailing lists, since Gmail is the #1 provider that we have
> trouble with message delivery due to their draconian threshold limits.
> However, I think if the default behaviour results in dumping 50,000 messages
> into people's inboxes, they wouldn't use it, which is why I think we should
> have a default that is lighter both on the server side and on the users.

OK, I think this could work (goes on top of my previous limit patch):
-----------8<-----------
Subject: [PATCH] pop3: limit default mailbox to 1K messages

This is probably friendlier to webmail providers which
support importing mail from POP3.
---
 lib/PublicInbox/POP3.pm    | 7 ++++---
 lib/PublicInbox/WwwText.pm | 3 +++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/POP3.pm b/lib/PublicInbox/POP3.pm
index 4a21ef5e..f97eccfd 100644
--- a/lib/PublicInbox/POP3.pm
+++ b/lib/PublicInbox/POP3.pm
@@ -72,7 +72,7 @@ sub cmd_user ($$) {
 	$user =~ tr/-//d; # most have dashes, some (dbus-uuidgen) don't
 	$user =~ m!\A[a-f0-9]{32}\z!i or return \"-ERR user has no UUID\r\n";
 
-	my $limit = UID_SLICE;
+	my $limit;
 	$mailbox =~ s/\?limit=([0-9]+)\z// and
 		$limit = $1 > UID_SLICE ? UID_SLICE : $1;
 
@@ -86,10 +86,11 @@ sub cmd_user ($$) {
 		my $tip = "$mailbox.$max";
 		return \"-ERR $mailbox.$slice does not exist ($tip does)\r\n"
 			if $slice > $max;
+		$limit //= UID_SLICE;
 		$self->{uid_base} = ($slice * UID_SLICE) + UID_SLICE - $limit;
 		$self->{slice} = $slice;
-	} else { # latest $limit messages
-		my $base = $uidmax - $limit;
+	} else { # latest $limit messages, 1k if unspecified
+		my $base = $uidmax - ($limit // 1000);
 		$self->{uid_base} = $base < 0 ? 0 : $base;
 		$self->{slice} = -1;
 	}
diff --git a/lib/PublicInbox/WwwText.pm b/lib/PublicInbox/WwwText.pm
index c31a7f86..f4508b3f 100644
--- a/lib/PublicInbox/WwwText.pm
+++ b/lib/PublicInbox/WwwText.pm
@@ -293,6 +293,9 @@ The POP3 password is: anonymous
 The POP3 username is: \$(uuidgen)\@$ctx->{ibx}->{newsgroup}
 where \$(uuidgen) in the output of the `uuidgen' command on your system.
 The UUID in the username functions as a private cookie (don't share it).
+By default, only 1000 messages are retrieved.  You may download more
+by appending `?limit=NUM' (without quotes) to the username, where
+`NUM' is an integer between 1 and 50000.
 Idle accounts will expire periodically.
 EOM
 	}

^ permalink raw reply related	[relevance 7%]

Results 1-4 of 4 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-09-12 21:08     pop3 usability thoughts Konstantin Ryabitsev
2023-09-12 22:40     ` [RFC] pop3: support `?limit=$NUM' parameter in mailbox name Eric Wong
2023-09-13 16:08       ` Konstantin Ryabitsev
2023-09-14  0:38  7%     ` Eric Wong
2023-09-15 20:03           ` Konstantin Ryabitsev
2023-09-15 20:41  7%         ` Eric Wong
2023-09-18 13:46  0%           ` Konstantin Ryabitsev
2023-09-18 21:14  0%             ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).