- atom_async_step($http->{forward});
-}
-
-# 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);
+ my $ctx = $http->{forward} or return;
+ eval {
+ if (my $smsg = $ctx->{smsg} = $ctx->{cb}->($ctx)) {
+ $ctx->smsg_blob($smsg);
+ } else {
+ $ctx->{http_out}->write($ctx->translate('</feed>'));
+ $ctx->close;
+ }
+ };
+ warn "E: $@" if $@;