]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Qspawn.pm
httpd/async: retry reads properly when parsing headers
[public-inbox.git] / lib / PublicInbox / Qspawn.pm
index ab0ef25c5611f3e645a4f4e593ae143ee94291a6..7984e35a80510ffdf09cbb7f5e325ecd9eb764a0 100644 (file)
@@ -109,8 +109,9 @@ sub finalize ($$) {
        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));
        }
 }
 
@@ -133,7 +134,7 @@ sub start ($$$) {
        }
 }
 
-sub psgi_qx_init_cb {
+sub psgi_qx_init_cb { # this may be PublicInbox::HTTPD::Async {cb}
        my ($self) = @_;
        my $async = delete $self->{async}; # PublicInbox::HTTPD::Async
        my ($r, $buf);
@@ -222,7 +223,7 @@ sub rd_hdr ($) {
        $ret;
 }
 
-sub psgi_return_init_cb {
+sub psgi_return_init_cb { # this may be PublicInbox::HTTPD::Async {cb}
        my ($self) = @_;
        my $r = rd_hdr($self) or return;
        my $env = $self->{psgi_env};