In case a relay process exits without printing at least one newline,
relay_close_if_done() will not close the relay context because there's
still pending data in the ustream.
Extend the relevant condition to only consider pending data if the relay
context is not in the header parsing state anymore.
Without this fix, requests triggering such a behaviour will never conclude.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
while (ustream_poll(&r->sfd.stream));
- if (!(r->process_done || s->eof) || ustream_pending_data(s, false))
+ if (!(r->process_done || s->eof) || (ustream_pending_data(s, false) && !r->header_cb))
return;
uh_relay_close(r, r->ret);