From 9c3c2eb9b021cd4c07f401c262c16e88a5c09a74 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 23 Oct 2025 10:21:00 +0000 Subject: [PATCH] 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. --- lib/PublicInbox/H1ReqRes.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } } -- 2.47.3