X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FMboxGz.pm;h=f7fc4afc147fab95da0df4f4ce483f78f942fa68;hb=3b1b7abf814dbc7f2a737b2ca0e12b0fa518ff44;hp=08e3c8464c4fb800fc075cd145d92ec16820a39e;hpb=55b707d788ce13696e4411389583e720ea6dab01;p=public-inbox.git
diff --git a/lib/PublicInbox/MboxGz.pm b/lib/PublicInbox/MboxGz.pm
index 08e3c846..f7fc4afc 100644
--- a/lib/PublicInbox/MboxGz.pm
+++ b/lib/PublicInbox/MboxGz.pm
@@ -1,9 +1,9 @@
-# Copyright (C) 2015-2019 all contributors
+# Copyright (C) 2015-2020 all contributors
# License: AGPL-3.0+
package PublicInbox::MboxGz;
use strict;
use warnings;
-use Email::Simple;
+use PublicInbox::Eml;
use PublicInbox::Hval qw/to_filename/;
use PublicInbox::Mbox;
use Compress::Raw::Zlib qw(Z_FINISH Z_OK);
@@ -21,12 +21,10 @@ 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 (defined $fn && $fn ne '') {
- $fn = to_filename($fn);
- push @h, 'Content-Disposition', "inline; filename=$fn.mbox.gz";
- }
- [ 200, \@h, $body ];
+ $fn = defined($fn) && $fn ne '' ? to_filename($fn) : 'no-subject';
+ my $h = [ qw(Content-Type application/gzip),
+ 'Content-Disposition', "inline; filename=$fn.mbox.gz" ];
+ [ 200, $h, $body ];
}
sub gzip_fail ($$) {
@@ -43,7 +41,7 @@ sub getline {
my $buf = delete($self->{buf});
while (my $smsg = $self->{cb}->($ctx)) {
my $mref = $ctx->{-inbox}->msg_by_smsg($smsg) or next;
- my $h = Email::Simple->new($mref)->header_obj;
+ my $h = PublicInbox::Eml->new($mref)->header_obj;
my $err = $gz->deflate(
PublicInbox::Mbox::msg_hdr($ctx, $h, $smsg->{mid}),