- my $bref = $self->{buf};
- if (length($$bref) >= 8192) {
- my $ret = $$bref; # copy :<
- ${$self->{buf}} = '';
- return $ret;
- }
+ my $err = $gz->deflate(
+ PublicInbox::Mbox::msg_hdr($ctx, $h, $smsg->{mid}),
+ $buf);
+ return gzip_fail($ctx, $err) if $err != Z_OK;
+
+ $err = $gz->deflate(PublicInbox::Mbox::msg_body($$mref), $buf);
+ return gzip_fail($ctx, $err) if $err != Z_OK;
+
+ return $buf if length($buf) >= 8192;