From ebb17e5da7ea1cca1a2ffa25ef66d6ae3fe764f6 Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Tue, 27 Sep 2022 14:54:05 +0300 Subject: [PATCH] connection: skip no-op calling of body generation functions when response body is not used --- src/microhttpd/connection.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index f33f9a9f..7624711a 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c @@ -5091,10 +5091,15 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) } #endif /* UPGRADE_SUPPORT */ - if (connection->rp.props.chunked) - connection->state = MHD_CONNECTION_CHUNKED_BODY_UNREADY; + if (connection->rp.props.send_reply_body) + { + if (connection->rp.props.chunked) + connection->state = MHD_CONNECTION_CHUNKED_BODY_UNREADY; + else + connection->state = MHD_CONNECTION_NORMAL_BODY_UNREADY; + } else - connection->state = MHD_CONNECTION_NORMAL_BODY_UNREADY; + connection->state = MHD_CONNECTION_FOOTERS_SENT; continue; case MHD_CONNECTION_NORMAL_BODY_READY: /* nothing to do here */