Browse Source

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 <jo@mein.io>
Jo-Philipp Wich 1 year ago
parent
commit
290ff883c6
1 changed files with 1 additions and 1 deletions
  1. 1 1
      relay.c

+ 1 - 1
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);