Prefer to use the original (cgit||git-http-backend) HTTP
response code if our fallback to WwwCoderepo fails. 404
codes is typically more appropriate than 500 for these things.
if ($code == 404 && $ctx->{www} && !$ctx->{_coderepo_tried}++) {
my $wcb = delete $ctx->{env}->{'qspawn.wcb'};
$ctx->{env}->{'plack.skip-deflater'} = 1; # prevent 2x gzip
+ $ctx->{env}->{'qspawn.fallback'} = $code;
my $res = $ctx->{www}->coderepo->srv($ctx);
# for ->psgi_return_init_cb
$ctx->{env}->{'qspawn.wcb'} = $wcb;
return if $self->{passed}; # another command chained it
if (my $wcb = delete $env->{'qspawn.wcb'}) {
# have we started writing, yet?
+ my $code = delete $env->{'qspawn.fallback'} // 500;
require PublicInbox::WwwStatic;
- $wcb->(PublicInbox::WwwStatic::r(500));
+ $wcb->(PublicInbox::WwwStatic::r($code));
}
}