-# this is public-inbox-httpd-specific
-sub atom_blob_cb { # git->cat_async callback
- my ($bref, $oid, $type, $size, $ctx) = @_;
- my $http = $ctx->{env}->{'psgix.io'} or return; # client abort
- my $smsg = delete $ctx->{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(\&atom_async_next);
- } else {
- $smsg->{blob} eq $oid or die "BUG: $smsg->{blob} != $oid";
- }
- my $buf = feed_entry($ctx, $smsg, PublicInbox::Eml->new($bref));
- if (my $gzf = $ctx->{gzf}) {
- $buf = $gzf->translate($buf);
- }
- # PublicInbox::HTTP::{Chunked,Identity}::write
- $ctx->{http_out}->write($buf);
-
- $http->next_step(\&atom_async_next);
-}
-
-sub atom_async_step { # this is public-inbox-httpd-specific
- my ($ctx) = @_;
- if (my $smsg = $ctx->{smsg} = $ctx->{cb}->($ctx)) {
- git_async_cat($ctx->{-inbox}->git, $smsg->{blob},
- \&atom_blob_cb, $ctx);
- } elsif (my $out = delete $ctx->{http_out}) {
- if (my $gzf = delete $ctx->{gzf}) {
- $out->write($gzf->zflush);
- }
- $out->close;
- }
+sub async_eml { # for async_blob_cb
+ my ($ctx, $eml) = @_;
+ my $smsg = delete $ctx->{smsg};
+ $ctx->{http_out}->write($ctx->translate(feed_entry($ctx, $smsg, $eml)))