about summary refs log tree commit homepage
path: root/lib/PublicInbox/WwwText.pm
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-07-05 23:27:21 +0000
committerEric Wong <e@yhbt.net>2020-07-06 20:01:15 +0000
commitf82c96666b5d51b426f227578112ba3a4fde0538 (patch)
tree8466c8e92c3778050e57ae619296e70faed4bfde /lib/PublicInbox/WwwText.pm
parent20f0d11445fc1207bc3a91e3f47abb4ba1b57256 (diff)
downloadpublic-inbox-f82c96666b5d51b426f227578112ba3a4fde0538.tar.gz
No point in streaming a tiny response via ->getline,
but we may stream to a gzipped buffer, later.
Diffstat (limited to 'lib/PublicInbox/WwwText.pm')
-rw-r--r--lib/PublicInbox/WwwText.pm17
1 files changed, 5 insertions, 12 deletions
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);
         }
-        '<pre>' . $l->linkify_2($$txt) . '</pre>';
+        $txt = '<pre>' . $l->linkify_2($txt) . '</pre>';
+        PublicInbox::WwwStream::html_oneshot($ctx, $code, \$txt);
 }
 
 sub _srch_prefix ($$) {