From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id B1DB61F524 for ; Sat, 8 Oct 2022 08:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1665217489; bh=CaSK2l5yAhNXPbZZ2d7ZUxPB74VR8OkxvMYOMnrg4Dw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pzVT2+0A7Zazw6NoGLGCIGvYcD70fZs+JEjR67crH1zy0pYSrhUAt9utXLVmo68mn eGCV8xryV8hWnR/+0L7vPw7S5UCHGFBhGidoS0gX68rlV8OVpSkQdEmmYnLibaKz7d YN7+4HTqzt/gdAbJcK5rjD3v1Vx0IiAD/Cwwz+cA= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 4/5] www: cgit: fix fallback to WwwCoderepo on array responses Date: Sat, 8 Oct 2022 08:24:47 +0000 Message-Id: <20221008082448.9856-5-e@80x24.org> In-Reply-To: <20221008082448.9856-1-e@80x24.org> References: <20221008082448.9856-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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. --- lib/PublicInbox/GitHTTPBackend.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 ]