From f2565a62da98879ac60fc17b633a88021f37faa9 Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Sun, 13 Mar 2022 20:31:45 +0300 Subject: [PATCH] MHD_set_response_options(): check whether the new flags could be used --- src/microhttpd/response.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c index e12b44a8..fbee6308 100644 --- a/src/microhttpd/response.c +++ b/src/microhttpd/response.c @@ -895,8 +895,15 @@ MHD_set_response_options (struct MHD_Response *response, enum MHD_Result ret; enum MHD_ResponseOptions ro; + if ( (0 != (response->flags & MHD_RF_INSANITY_HEADER_CONTENT_LENGTH)) && + (0 == (flags & MHD_RF_INSANITY_HEADER_CONTENT_LENGTH))) + { /* Request to remove MHD_RF_INSANITY_HEADER_CONTENT_LENGTH flag */ + if (0 != (response->flags_auto & MHD_RAF_HAS_CONTENT_LENGTH)) + return MHD_NO; + } ret = MHD_YES; response->flags = flags; + va_start (ap, flags); while (MHD_RO_END != (ro = va_arg (ap, enum MHD_ResponseOptions))) {