+sub html_oneshot ($$;$) {
+ my ($ctx, $code, $sref) = @_;
+ $ctx->{base_url} = base_url($ctx);
+ bless $ctx, __PACKAGE__;
+ my @bdy;
+ my $res_hdr = [ 'Content-Type' => 'text/html; charset=UTF-8',
+ 'Content-Length' => undef ];
+ $ctx->{gz} = PublicInbox::GzipFilter::gz_or_noop($res_hdr, $ctx->{env});
+ $ctx->zmore(html_top($ctx));
+ $ctx->zmore($$sref) if $sref;
+ $bdy[0] = $ctx->zflush(_html_end($ctx));
+ $res_hdr->[3] = bytes::length($bdy[0]);
+ [ $code, $res_hdr, \@bdy ]