summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHauke Mehrtens2025-07-06 18:52:17 +0000
committerHauke Mehrtens2025-07-06 22:58:07 +0000
commit7e64e8bad2415cec0a6d9770ec379db54273c7a7 (patch)
treeb4544699c47afa6dfb25263d7091a7a237bff8fd
parentc7294e7037a9e6f8fb4b9084d31cb8e98bd7b5f9 (diff)
client: Allow sending content in DONE state
Allow sending content even when the connection is in done state. When we run into an error we will be in CLIENT_STATE_DONE state and have to write some content to the client. Allow writing in normal DATA and in DONE state. This fixes http error 403 in LuCI. Fixes: b3e3c05d6781 ("client: don't send stray EOF chunk on connection timeout") Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--utils.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/utils.c b/utils.c
index 5304c2a..e10d1dc 100644
--- a/utils.c
+++ b/utils.c
@@ -56,7 +56,8 @@ void uh_chunk_vprintf(struct client *cl, const char *format, va_list arg)
va_list arg2;
int len;
- if (cl->state != CLIENT_STATE_DATA)
+ if (cl->state != CLIENT_STATE_DATA &&
+ cl->state != CLIENT_STATE_DONE)
return;
uloop_timeout_set(&cl->timeout, conf.network_timeout * 1000);
@@ -91,7 +92,8 @@ void uh_chunk_eof(struct client *cl)
if (!uh_use_chunked(cl))
return;
- if (cl->state != CLIENT_STATE_DATA)
+ if (cl->state != CLIENT_STATE_DATA &&
+ cl->state != CLIENT_STATE_DONE)
return;
ustream_printf(cl->us, "0\r\n\r\n");