libmicrohttpd

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

commit 9c70bc55517cc61804a1d88540305d0477557eb6
parent e09b6df63edaa076388820d63a8cdccfd35e33cb
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Sun, 13 Dec 2020 13:12:51 +0300

Do not send dynamic response body with header

Fixed regression introduced by 3b435274a2b3cd206201cc6140f2c70016a03bd2
Do not use response dynamic data while responses have
connection-specific data and need to be locked

Diffstat:
Msrc/microhttpd/connection.c | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -2919,14 +2919,16 @@ MHD_connection_handle_write (struct MHD_Connection *connection) connection->write_buffer_send_offset); mhd_assert (NULL != connection->response); mhd_assert ( (0 == connection->response->data_size) || \ - (0 == connection->response->data_start) ); + (0 == connection->response->data_start) || \ + (NULL != connection->response->crc) ); mhd_assert ( (0 == connection->response_write_position) || \ (response->total_size == connection->response_write_position) || \ (MHD_SIZE_UNKNOWN == connection->response_write_position) ); - if (0 == connection->response_write_position) + if ( (NULL == connection->response->crc) && + (0 == connection->response_write_position) ) { /* Send response headers alongside the response body, if the body * data is available. */ @@ -2939,8 +2941,8 @@ MHD_connection_handle_write (struct MHD_Connection *connection) } else { - /* This is response for HEAD request or reply body is not allowed - * for any other reason. */ + /* This is response for HEAD request, reply body is not allowed + * for any other reason or reply body is dynamically generated. */ /* Do not send the body data even if it's available. */ ret = MHD_send_on_connection2_ (connection, &connection->write_buffer