- my $n = 0;
- Plack::Util::inline_object(
- close => sub {}, # noop
- getline => sub {
- my $nr = $n++;
- if ($nr == 0) {
- headers_to_html_header($hdr, $ctx) .
- multipart_text_as_html($mime, '') .
- '</pre><hr />'
- } elsif ($nr == 1) {
- '<pre>' .
- html_footer($hdr, 1, $ctx) .
- '</pre>' . msg_reply($ctx, $hdr) .
- '<hr /><pre>'. $footer .
- '</pre></body></html>'
- } else {
- undef
- }
+ my $tip = _msg_html_prepare($hdr, $ctx);
+ PublicInbox::WwwStream->new($ctx, sub {
+ my ($nr, undef) = @_;
+ if ($nr == 1) {
+ $tip . multipart_text_as_html($mime, '') .
+ '</pre><hr />'
+ } elsif ($nr == 2) {
+ '<pre>' . html_footer($hdr, 1, $ctx) .
+ '</pre>' . msg_reply($ctx, $hdr) . '<hr />'
+ } else {
+ undef