]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Mbox.pm
www: support listing of inboxes
[public-inbox.git] / lib / PublicInbox / Mbox.pm
index 4427ae5d86588056c6d7e9108314e8cfd6dff75f..78dbe27e30a0366c7788a6edc004728556312e0e 100644 (file)
@@ -1,8 +1,12 @@
 # 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;
@@ -130,9 +134,9 @@ sub thread_mbox {
        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) {
@@ -142,7 +146,7 @@ sub thread_mbox {
                        # refill result set
                        $msgs = $srch->get_thread($mid, $prev);
                        return unless @$msgs;
-                       $prev = $msgs->[-1]->{num};
+                       $prev = $msgs->[-1];
                        $i = 0;
                }
        };