# Used by PublicInbox::WWW
package PublicInbox::WwwListing;
use strict;
+use v5.10.1;
use PublicInbox::Hval qw(prurl fmt_ts ascii_html);
use PublicInbox::Linkify;
use PublicInbox::GzipFilter qw(gzf_maybe);
use PublicInbox::ConfigIter;
use PublicInbox::WwwStream;
-use bytes (); # bytes::length
sub ibx_entry {
my ($ctx, $ibx, $ce) = @_;
} elsif ($v eq 'all') {
(qr/./, undef);
} elsif ($v eq '404') {
- undef;
+ (undef, undef);
} else {
warn <<EOF;
`$v' is not a valid value for `$key'
$qs = "( $qs ) AND ( $user_query )";
}
my $mset = $misc->mset($qs, $opt); # sorts by $MODIFIED (mtime)
- $ctx->{-list} = [];
+ delete $ctx->{-list}; # reset if retried
my $pi_cfg = $ctx->{www}->{pi_cfg};
for my $mi ($mset->items) {
my $doc = $mi->get_document;
my ($re, $qs) = $ctx->url_filter;
$re // return $ctx->psgi_triple;
if (my $ALL = $ctx->{www}->{pi_cfg}->ALL) { # fast path
+ # FIXME: test this in t/
$ALL->misc->reopen->retry_reopen(\&add_misc_ibx,
$ctx, $re, $qs);
} else { # slow path, no [extindex "all"] configured
my $h = [ 'Content-Type', 'text/html; charset=UTF-8',
'Content-Length', undef ];
my $gzf = gzf_maybe($h, $ctx->{env});
- $gzf->zmore('<html><head><title>' .
- 'public-inbox listing</title>' .
- '</head><body>');
+ $gzf->zmore('<html><head><title>public-inbox listing</title>' .
+ $ctx->{www}->style('+/') .
+ '</head><body>');
my $code = 404;
if (my $list = delete $ctx->{-list}) {
my $mset = delete $ctx->{-mset};
my $out = $gzf->zflush('</pre><hr><pre>'.
PublicInbox::WwwStream::code_footer($ctx->{env}) .
'</pre></body></html>');
- $h->[3] = bytes::length($out);
+ $h->[3] = length($out);
[ $code, $h, [ $out ] ];
}