summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-08-03 00:23:54 +0200
committerJo-Philipp Wich <jo@mein.io>2022-08-03 00:47:03 +0200
commit290ff883c69ac935ee3f22733d77d2a5a932f585 (patch)
treee70a80dc6470273a8fd4e07a2f07cc77b4c0cff9
parent145a309c54b7a9ff46fc588783f58804c23b09ab (diff)
downloaduhttpd2-290ff883c69ac935ee3f22733d77d2a5a932f585.tar.gz
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>
-rw-r--r--relay.c2
1 files changed, 1 insertions, 1 deletions
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);