From 81bbdc7048ca31ebe23c00918e8a5b5852b0f687 Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Fri, 30 Apr 2021 18:02:00 +0300 Subject: [PATCH] chunked_example: enforce to use chunked encoding Previously MHD switches to identity encoding if connection is not Keep-Alive --- src/examples/chunked_example.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/examples/chunked_example.c b/src/examples/chunked_example.c index 6f449c3a..ed20d472 100644 --- a/src/examples/chunked_example.c +++ b/src/examples/chunked_example.c @@ -137,6 +137,14 @@ ahc_echo (void *cls, free (callback_param); return MHD_NO; } + /* Enforce chunked response, even for non-keep-alive connection. */ + if (MHD_NO == MHD_add_response_header (response, + MHD_HTTP_HEADER_TRANSFER_ENCODING, + "chunked")) + { + free (callback_param); + return MHD_NO; + } ret = MHD_queue_response (connection, MHD_HTTP_OK, response); MHD_destroy_response (response); return ret;