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.
$self->requeue if push(@{$self->{wbuf}}, \&send_req_body) == 1;
} else {
delete $self->{req_left};
- pass_res_hdr $self;
+ $self->write(\&pass_res_hdr);
}
}