From 9ca0b36ab0de26a0e2564f27fa25b6680965c196 Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Fri, 4 Jun 2021 12:59:45 +0300 Subject: connection: do not spend time on building footers for zero-sized responses Footers are not used for non-chunked responses. --- src/microhttpd/connection.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 938031c4..321952eb 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c @@ -3779,7 +3779,11 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) if (NULL != connection->response->crc) MHD_mutex_unlock_chk_ (&connection->response->mutex); #endif - connection->state = MHD_CONNECTION_BODY_SENT; + /* TODO: replace with 'use_chunked_send' */ + if (connection->have_chunked_upload) + connection->state = MHD_CONNECTION_BODY_SENT; + else + connection->state = MHD_CONNECTION_FOOTERS_SENT; continue; } if (MHD_NO != try_ready_normal_body (connection)) -- cgit v1.2.3