use Compress::Raw::Zlib qw(Z_FINISH Z_OK);
my %OPT = (-WindowBits => 15 + 16, -AppendOutput => 1);
use Compress::Raw::Zlib qw(Z_FINISH Z_OK);
my %OPT = (-WindowBits => 15 + 16, -AppendOutput => 1);
my ($class, $ctx, $cb, $fn) = @_;
my $body = $class->new($ctx, $cb);
# http://www.iana.org/assignments/media-types/application/gzip
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 ];
+ $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 ];
my $mref = $ctx->{-inbox}->msg_by_smsg($smsg) or next;
my $h = Email::Simple->new($mref)->header_obj;
my $mref = $ctx->{-inbox}->msg_by_smsg($smsg) or next;
my $h = Email::Simple->new($mref)->header_obj;
# signal that we're done and can return undef next call:
delete $self->{ctx};
my $err = $gz->flush($buf, Z_FINISH);
# signal that we're done and can return undef next call:
delete $self->{ctx};
my $err = $gz->flush($buf, Z_FINISH);