libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 81bbdc7048ca31ebe23c00918e8a5b5852b0f687
parent 3569c42c4cc116818d765a6c81955af2b8a9dbe4
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Fri, 30 Apr 2021 18:02:00 +0300

chunked_example: enforce to use chunked encoding

Previously MHD switches to identity encoding if connection
is not Keep-Alive

Diffstat:
Msrc/examples/chunked_example.c | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git 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;