From: Eric Wong Date: Thu, 23 Oct 2025 10:21:00 +0000 (+0000) Subject: psgi_rproxy: fix uploads with small output buffers X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9c3c2eb9b021cd4c07f401c262c16e88a5c09a74;p=thirdparty%2Fpublic-inbox.git psgi_rproxy: fix uploads with small output buffers Attempting to call pass_res_hdr directly fails when the previous DS->write to the upstream hit EAGAIN. Ensure correct ordering by relying on DS->write to call the pass_res_hdr subroutine after the previous DS->write is complete. In other words, we must not try reading the upstream response until our request is fully sent to the upstream. I noticed this after installing HTTP::Parser::XS (p5-HTTP-Parser-XS) on my FreeBSD machine since our PsgiRproxy module depends the XS package for parsing HTTP/1.x responses. --- diff --git a/lib/PublicInbox/H1ReqRes.pm b/lib/PublicInbox/H1ReqRes.pm index 8f49b45b6..ad99a5c77 100644 --- a/lib/PublicInbox/H1ReqRes.pm +++ b/lib/PublicInbox/H1ReqRes.pm @@ -354,7 +354,7 @@ sub send_req_body { # called by flush_write $self->requeue if push(@{$self->{wbuf}}, \&send_req_body) == 1; } else { delete $self->{req_left}; - pass_res_hdr $self; + $self->write(\&pass_res_hdr); } }