diff options
author | Eric Wong <e@yhbt.net> | 2020-04-21 06:57:34 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-04-22 07:04:45 +0000 |
commit | a318e758129d616b3b801db82c4735c680a2fbe8 (patch) | |
tree | ba9af6a937ecf8f2a7dc339a25f1ad2a0c0ddc75 /lib/PublicInbox/WwwListing.pm | |
parent | a45aef4d6415553dd1f6744770b00ea9033f58d7 (diff) | |
download | public-inbox-a318e758129d616b3b801db82c4735c680a2fbe8.tar.gz |
This allows us to simplify some of our existing code and make future changes easier. I doubt anybody goes through the trouble to have a Perl installation without zlib support. The zlib source code is even bundled with Perl since 5.9.3 for systems without existing zlib development headers and libraries. Of course, zlib is also a requirement of git, too; and we're not going to stop using git :) [squashed: "wwwaltid: use gzipfilter up front"]
Diffstat (limited to 'lib/PublicInbox/WwwListing.pm')
-rw-r--r-- | lib/PublicInbox/WwwListing.pm | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/PublicInbox/WwwListing.pm b/lib/PublicInbox/WwwListing.pm index 42a0c0d8..38a37dda 100644 --- a/lib/PublicInbox/WwwListing.pm +++ b/lib/PublicInbox/WwwListing.pm @@ -14,14 +14,13 @@ use bytes (); # bytes::length 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 { @@ -220,7 +219,7 @@ sub js ($$) { $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), |