- my $fh = $_[0]->([501, ['Content-Type' => 'text/html']]);
- my $title = 'gzipped mbox not available';
- $fh->write(<<EOF);
-<html><head><title>$title</title><body><pre>$title
-The administrator needs to install the IO::Compress::Gzip Perl module
-to support gzipped mboxes.
-<a href="../">Return to index</a></pre></body></html>
-EOF
- $fh->close;
-}
-
-1;
-
-package PublicInbox::MboxGz;
-use strict;
-use warnings;
-use PublicInbox::Hval qw/to_filename/;
-
-sub new {
- my ($class, $ctx, $cb) = @_;
- my $buf = '';
- bless {
- buf => \$buf,
- gz => IO::Compress::Gzip->new(\$buf, Time => 0),
- cb => $cb,
- ctx => $ctx,
- }, $class;
-}
-
-sub response {
- my ($class, $ctx, $cb, $fn) = @_;
- my $body = $class->new($ctx, $cb);
- # http://www.iana.org/assignments/media-types/application/gzip
- my @h = qw(Content-Type application/gzip);
- if ($fn) {
- $fn = to_filename($fn);
- push @h, 'Content-Disposition', "inline; filename=$fn.mbox.gz";
- }
- [ 200, \@h, $body ];
-}
+ html_oneshot($_[0], 501, \<<EOF);
+<pre>gzipped mbox not available