From: Jo-Philipp Wich Date: Tue, 2 Aug 2022 22:23:54 +0000 (+0200) Subject: relay: trigger close if in header read state with pending data X-Git-Url: http://git.openwrt.org/?p=project%2Fuhttpd.git;a=commitdiff_plain;h=290ff883c69ac935ee3f22733d77d2a5a932f585 relay: trigger close if in header read state with pending data 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 --- diff --git a/relay.c b/relay.c index 7331a0a..6db58ac 100644 --- a/relay.c +++ b/relay.c @@ -155,7 +155,7 @@ static void relay_close_if_done(struct uloop_timeout *timeout) 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);