I use the following sequence of commands:
MHD_Response* resp = MHD_create_response_from_callback (
asyncReplyCallback, c, asyncReplyCleaner );
MHD_add_response_header (c->mConnection, "Content-Type", "application/json" );
MHD_queue_response ( c->mConnection, MHD_HTTP_OK , resp );
The callback function does approx. the following:
<1 or more times: copy data to provided buffer and return data length >
return MHD_CONTENT_READER_END_OF_STREAM; /* when data is finished */
In general this code works, but with problems:
1. Despite the library adds the "Transfer-encoding: chunked", there is no chunk formatting in data. All, what is returned from callback, is transmitted "as is".
2. The response header is not set. (Content-Type)
Is there any way to handle the reply from callback properly?