diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-04-30 18:02:00 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-05-06 11:26:34 +0300 |
commit | 81bbdc7048ca31ebe23c00918e8a5b5852b0f687 (patch) | |
tree | c9415b8fdbcb4a8524d1e6132f5a0d02977b96d7 | |
parent | 3569c42c4cc116818d765a6c81955af2b8a9dbe4 (diff) | |
download | libmicrohttpd-81bbdc7048ca31ebe23c00918e8a5b5852b0f687.tar.gz libmicrohttpd-81bbdc7048ca31ebe23c00918e8a5b5852b0f687.zip |
chunked_example: enforce to use chunked encoding
Previously MHD switches to identity encoding if connection
is not Keep-Alive
-rw-r--r-- | src/examples/chunked_example.c | 8 |
1 files changed, 8 insertions, 0 deletions
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, | |||
137 | free (callback_param); | 137 | free (callback_param); |
138 | return MHD_NO; | 138 | return MHD_NO; |
139 | } | 139 | } |
140 | /* Enforce chunked response, even for non-keep-alive connection. */ | ||
141 | if (MHD_NO == MHD_add_response_header (response, | ||
142 | MHD_HTTP_HEADER_TRANSFER_ENCODING, | ||
143 | "chunked")) | ||
144 | { | ||
145 | free (callback_param); | ||
146 | return MHD_NO; | ||
147 | } | ||
140 | ret = MHD_queue_response (connection, MHD_HTTP_OK, response); | 148 | ret = MHD_queue_response (connection, MHD_HTTP_OK, response); |
141 | MHD_destroy_response (response); | 149 | MHD_destroy_response (response); |
142 | return ret; | 150 | return ret; |