-# this is public-inbox-httpd-specific
-sub mboxgz_blob_cb { # git->cat_async callback
- my ($bref, $oid, $type, $size, $self) = @_;
- my $http = $self->{env}->{'psgix.io'} or return; # client abort
- my $smsg = delete $self->{smsg} or die 'BUG: no smsg';
- if (!defined($oid)) {
- # it's possible to have TOCTOU if an admin runs
- # public-inbox-(edit|purge), just move onto the next message
- return $http->next_step(\&mboxgz_async_next);
- } else {
- $smsg->{blob} eq $oid or die "BUG: $smsg->{blob} != $oid";
- }
- my $eml = PublicInbox::Eml->new($bref);
- $self->zmore(msg_hdr($self, $eml, $smsg->{mid}));
-
- # PublicInbox::HTTP::{Chunked,Identity}::write
- $self->{http_out}->write($self->translate(msg_body($eml)));
-
- $http->next_step(\&mboxgz_async_next);
-}
-
-# this is public-inbox-httpd-specific
-sub mboxgz_async_step ($) {
- my ($self) = @_;
- if (my $smsg = $self->{smsg} = $self->{cb}->($self)) {
- git_async_cat($self->{-inbox}->git, $smsg->{blob},
- \&mboxgz_blob_cb, $self);
- } elsif (my $out = delete $self->{http_out}) {
- $out->write($self->zflush);
- $out->close;
- }
-}
-
-# called by PublicInbox::DS::write
-sub mboxgz_async_next {