about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-10-08 08:24:47 +0000
committerEric Wong <e@80x24.org>2022-10-09 16:48:38 +0000
commitdda0b4ab620e1709c0e25b3d9d70745fe52d60d3 (patch)
tree3bce5fdb809237cba08514cdb5c228e745a33851 /lib
parentcb4f3af963674ccdb0d540656bd2c58f9e130cf9 (diff)
downloadpublic-inbox-dda0b4ab620e1709c0e25b3d9d70745fe52d60d3.tar.gz
For fast PSGI responses which don't require returning a coderef,
just reuse qspawn.wcb directly on the arrayref to avoid an undef
$wcb from firing in psgi_return_init_cb.

I only noticed this because the ViewVCS search form is broken
for /$CODEREPO/$OID/s/ endpoints at the moment.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/GitHTTPBackend.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm
index 61a13560..3aae5454 100644
--- a/lib/PublicInbox/GitHTTPBackend.pm
+++ b/lib/PublicInbox/GitHTTPBackend.pm
@@ -155,7 +155,11 @@ sub parse_cgi_headers {
                 delete $ctx->{env}->{'qspawn.wcb'};
                 $ctx->{env}->{'plack.skip-deflater'} = 1; # prevent 2x gzip
                 my $res = $ctx->{www}->coderepo->srv(\%ctx);
-                $res->(delete $ctx{env}->{'qspawn.wcb'}) if ref($res) eq 'CODE';
+                if (ref($res) eq 'CODE') {
+                        $res->(delete $ctx{env}->{'qspawn.wcb'});
+                } else { # ref($res) eq 'ARRAY'
+                        $ctx->{env}->{'qspawn.wcb'} = $ctx{env}->{'qspawn.wcb'};
+                }
                 $res; # non ARRAY ref for ->psgi_return_init_cb
         } else {
                 [ $code, \@h ]