# Copyright (C) 2015-2018 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
-# Streaming interface for formatting messages as an mboxrd.
-# Used by the web interface
+# Streaming (via getline) interface for formatting messages as an mboxrd.
+# Used by the PSGI web interface.
+#
+# public-inbox-httpd favors "getline" response bodies to take a
+# "pull"-based approach to feeding slow clients (as opposed to a
+# more common "push" model)
package PublicInbox::Mbox;
use strict;
use warnings;
eval { require IO::Compress::Gzip };
return sub { need_gzip(@_) } if $@;
my $mid = $ctx->{mid};
- my $msgs = $srch->get_thread($mid, 0);
+ my $msgs = $srch->get_thread($mid, {});
return [404, [qw(Content-Type text/plain)], []] if !@$msgs;
- my $prev = $msgs->[-1]->{num};
+ my $prev = $msgs->[-1];
my $i = 0;
my $cb = sub {
while (1) {
# refill result set
$msgs = $srch->get_thread($mid, $prev);
return unless @$msgs;
- $prev = $msgs->[-1]->{num};
+ $prev = $msgs->[-1];
$i = 0;
}
};