commit cb5332ab4328374822f3051e6effbfac1f03b815 parent 4e01fd656aba4156d63e5a33e671dcfa8d8a8783 Author: Evgeny Grin (Karlson2k) <k2k@narod.ru> Date: Wed, 29 Sep 2021 17:30:15 +0300 transmit_error_response(): avoid double sending of error responses Diffstat:
| M | src/microhttpd/connection.c | | | 8 | ++++++++ |
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -2200,6 +2200,14 @@ transmit_error_response_len (struct MHD_Connection *connection, struct MHD_Response *response; enum MHD_Result iret; + mhd_assert (! connection->stop_with_error); /* Send error one time only */ + if (connection->stop_with_error) + { /* Should not happen */ + if (MHD_CONNECTION_CLOSED > connection->state) + connection->state = MHD_CONNECTION_CLOSED; + + return; + } connection->stop_with_error = true; /* TODO: remove when special error queue function is implemented */ connection->state = MHD_CONNECTION_FULL_REQ_RECEIVED;