# - Must not rely on static content
# - UTF-8 is only for user-content, 7-bit US-ASCII for us
package PublicInbox::WWW;
-use 5.010_001;
use strict;
-use warnings;
-use bytes (); # only for bytes::length
+use v5.10.1;
use PublicInbox::Config;
use PublicInbox::Hval;
use URI::Escape qw(uri_unescape);
if (defined($pi_cfg->{'publicinbox.cgitrc'})) {
$pi_cfg->limiter('-cgit');
}
+ $pi_cfg->ALL and require PublicInbox::Isearch;
$self->cgit;
$self->stylesheets_prepare($_) for ('', '../', '../../');
$self->news_www;
- $pi_cfg->each_inbox(\&preload_inbox);
}
}
-sub preload_inbox {
- my $ibx = shift;
- $ibx->altid_map;
- $ibx->cloneurl;
- $ibx->description;
- $ibx->base_url;
-}
-
# private functions below
sub r404 {
$css = PublicInbox::UserContent::sample($ctx->{ibx}, $env);
}
defined $css or return r404();
- my $h = [ 'Content-Length', bytes::length($css),
- 'Content-Type', 'text/css' ];
+ my $h = [ 'Content-Length', length($css), 'Content-Type', 'text/css' ];
PublicInbox::GitHTTPBackend::cache_one_year($h);
[ 200, $h, [ $css ] ];
}
my ($ctx, $inbox) = @_;
invalid_inbox($ctx, $inbox) || do {
my $d = $ctx->{ibx}->description . "\n";
- [ 200, [ 'Content-Length', bytes::length($d),
+ utf8::encode($d);
+ [ 200, [ 'Content-Length', length($d),
'Content-Type', 'text/plain' ], [ $d ] ];
};
}
+sub event_step { # called via requeue
+ my ($self) = @_;
+ # gzf = PublicInbox::GzipFilter == $ctx
+ my $gzf = shift(@{$self->{-low_prio_q}}) // return;
+ PublicInbox::DS::requeue($self) if scalar(@{$self->{-low_prio_q}});
+ my $http = $gzf->{env}->{'psgix.io'}; # PublicInbox::HTTP
+ $http->next_step($gzf->can('async_next'));
+}
+
1;