# `perl5' on FreeBSD
'Encode' => 0,
+ # libperl$PERL_VERSION + perl-modules-$PERL_VERSION
+ 'Compress::Raw::Zlib' => 0,
+ 'Compress::Zlib' => 0,
+ 'IO::Compress::Gzip' => 0,
+
# Plack is needed for public-inbox-httpd and PublicInbox::WWW
# 'Plack' => 0,
Email::MIME::ContentType
Encode
ExtUtils::MakeMaker
+ IO::Compress::Gzip
URI::Escape
), @test_essential ],
DBD::SQLite
DBI
Filesys::Notify::Simple
- IO::Compress::Gzip
Inline::C
Net::Server
Plack
sub thread_mbox {
my ($ctx, $over, $sfx) = @_;
- eval { require PublicInbox::MboxGz };
- return need_gzip($ctx) if $@;
+ require PublicInbox::MboxGz;
my $msgs = $ctx->{msgs} = $over->get_thread($ctx->{mid}, {});
return [404, [qw(Content-Type text/plain)], []] if !@$msgs;
$ctx->{prev} = $msgs->[-1];
sub mbox_all {
my ($ctx, $query) = @_;
- eval { require PublicInbox::MboxGz };
- return need_gzip($ctx) if $@;
+ require PublicInbox::MboxGz;
return mbox_all_ids($ctx) if $query eq '';
my $qopts = $ctx->{qopts} = { mset => 2 };
my $srch = $ctx->{srch} = $ctx->{-inbox}->search or
PublicInbox::MboxGz->response($ctx, \&results_cb, 'results-'.$query);
}
-sub need_gzip {
- html_oneshot($_[0], 501, \<<EOF);
-<pre>gzipped mbox not available
-
-The administrator needs to install the Compress::Raw::Zlib Perl module
-to support gzipped mboxes.
-
-<a href="../">Return to index</a></pre>
-EOF
-}
-
1;
LIST ACTIVE ACTIVE.TIMES NEWSGROUPS OVERVIEW.FMT\r
HDR\r
OVER\r
-
-my $have_deflate;
+COMPRESS DEFLATE\r
sub greet ($) { $_[0]->write($_[0]->{nntpd}->{greet}) };
sub cmd_compress ($$) {
my ($self, $alg) = @_;
return '503 Only DEFLATE is supported' if uc($alg) ne 'DEFLATE';
- return r502 if $self->compressed || !$have_deflate;
+ return r502 if $self->compressed;
PublicInbox::NNTPdeflate->enable($self);
$self->requeue;
undef
($self->{rbuf} || $self->{wbuf} || $self->not_idle_long($now));
}
-# this is an import to prevent "perl -c" from complaining about fields
-sub import {
- $have_deflate = eval { require PublicInbox::NNTPdeflate } and
- $CAPABILITIES .= "COMPRESS DEFLATE\r\n";
-}
-
1;
use PublicInbox::WwwStream qw(html_oneshot);
use PublicInbox::AltId;
use PublicInbox::Spawn qw(which);
+use PublicInbox::GzipFilter;
our $sqlite3 = $ENV{SQLITE3};
sub sqlite3_missing ($) {
EOF
}
- eval { require PublicInbox::GzipFilter } or
- return html_oneshot($ctx, 501, \<<EOF);
-<pre>gzip output not available
-
-The administrator needs to install the Compress::Raw::Zlib Perl module
-to support gzipped sqlite3 dumps.</pre>
-EOF
$sqlite3 //= which('sqlite3');
if (!defined($sqlite3)) {
return html_oneshot($ctx, 501, \<<EOF);
use HTTP::Date qw(time2str);
use Digest::SHA ();
use File::Spec ();
+use IO::Compress::Gzip qw(gzip);
*try_cat = \&PublicInbox::Inbox::try_cat;
our $json;
-if (eval { require IO::Compress::Gzip }) {
- for my $mod (qw(JSON::MaybeXS JSON JSON::PP)) {
- eval "require $mod" or next;
- # ->ascii encodes non-ASCII to "\uXXXX"
- $json = $mod->new->ascii(1) and last;
- }
+for my $mod (qw(JSON::MaybeXS JSON JSON::PP)) {
+ eval "require $mod" or next;
+ # ->ascii encodes non-ASCII to "\uXXXX"
+ $json = $mod->new->ascii(1) and last;
}
sub list_all_i {
$repo->{reference} = $abs2urlpath->{$abs};
}
my $out;
- IO::Compress::Gzip::gzip(\($json->encode($manifest)) => \$out);
+ gzip(\($json->encode($manifest)) => \$out);
$manifest = undef;
[ 200, [ qw(Content-Type application/gzip),
'Last-Modified', time2str($mtime),
use strict;
use warnings;
use PublicInbox::Daemon;
-use PublicInbox::NNTP; # need to call import
+use PublicInbox::NNTPdeflate; # loads PublicInbox::NNTP
use PublicInbox::NNTPD;
my $nntpd = PublicInbox::NNTPD->new;
PublicInbox::Daemon::run('0.0.0.0:119',