diff options
author | Eric Wong <e@80x24.org> | 2022-10-05 22:29:40 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2022-10-07 07:27:26 +0000 |
commit | 26037c85f73de67197af1987e4c0fa4786ac1e31 (patch) | |
tree | 52d7f462fe42bd091fca039dc2956c0707ff5a4f /lib/PublicInbox/Qspawn.pm | |
parent | 9fe2348fc4a3462b2de0483b1a1f4baf6edff14c (diff) | |
download | public-inbox-26037c85f73de67197af1987e4c0fa4786ac1e31.tar.gz |
We can't rely on 3-element array response when calling WwwCoderepo for ViewVCS endpoints since that uses Qspawn internally. Thus, we have to allow two Qspawn objects to run in parallel and ensure `qspawn.wcb' only gets called once, so we end up duplicating the entire $ctx to ensure this.
Diffstat (limited to 'lib/PublicInbox/Qspawn.pm')
-rw-r--r-- | lib/PublicInbox/Qspawn.pm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/PublicInbox/Qspawn.pm b/lib/PublicInbox/Qspawn.pm index cea34fc3..ef9db43e 100644 --- a/lib/PublicInbox/Qspawn.pm +++ b/lib/PublicInbox/Qspawn.pm @@ -225,19 +225,19 @@ sub psgi_return_init_cb { my ($self) = @_; my $r = rd_hdr($self) or return; my $env = $self->{psgi_env}; - my $filter = delete $env->{'qspawn.filter'} // - PublicInbox::GzipFilter::qsp_maybe($r->[1], $env); + my $filter = delete($env->{'qspawn.filter'}) // (ref($r) eq 'ARRAY' ? + PublicInbox::GzipFilter::qsp_maybe($r->[1], $env) : undef); my $wcb = delete $env->{'qspawn.wcb'}; my $async = delete $self->{async}; # PublicInbox::HTTPD::Async - if (scalar(@$r) == 3) { # error + if (ref($r) ne 'ARRAY' || scalar(@$r) == 3) { # error if ($async) { # calls rpipe->close && ->event_step $async->close; # PublicInbox::HTTPD::Async::close } else { $self->{rpipe}->close; event_step($self); } - $wcb->($r); + $wcb->($r) if ref($r) eq 'ARRAY'; } elsif ($async) { # done reading headers, handoff to read body my $fh = $wcb->($r); # scalar @$r == 2 |