From f82c96666b5d51b426f227578112ba3a4fde0538 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 5 Jul 2020 23:27:21 +0000 Subject: wwwtext: switch to html_oneshot No point in streaming a tiny response via ->getline, but we may stream to a gzipped buffer, later. --- lib/PublicInbox/WwwText.pm | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'lib/PublicInbox/WwwText.pm') diff --git a/lib/PublicInbox/WwwText.pm b/lib/PublicInbox/WwwText.pm index 508005fb..ea50428e 100644 --- a/lib/PublicInbox/WwwText.pm +++ b/lib/PublicInbox/WwwText.pm @@ -64,25 +64,18 @@ sub get_text { # Follow git commit message conventions, # first line is the Subject/title my ($title) = ($txt =~ /\A([^\n]*)/s); - $ctx->{txt} = \$txt; $ctx->{-title_html} = ascii_html($title); my $nslash = ($key =~ tr!/!/!); $ctx->{-upfx} = '../../../' . ('../' x $nslash); - PublicInbox::WwwStream->response($ctx, $code, \&_do_linkify); -} - -sub _do_linkify { - my ($nr, $ctx) = @_; - return unless $nr == 1; my $l = PublicInbox::Linkify->new; - my $txt = delete $ctx->{txt}; - $l->linkify_1($$txt); + $l->linkify_1($txt); if ($hl) { - $hl->do_hl_text($txt); + $hl->do_hl_text(\$txt); } else { - $$txt = ascii_html($$txt); + $txt = ascii_html($txt); } - '
' . $l->linkify_2($$txt) . '
'; + $txt = '
' . $l->linkify_2($txt) . '
'; + PublicInbox::WwwStream::html_oneshot($ctx, $code, \$txt); } sub _srch_prefix ($$) { -- cgit v1.2.3-24-ge0c7