libmicrohttpd

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

commit e74fad60005e8fb18b67ea77e84c9875a94d18a3
parent b9743114cf6d4584968cfbfd3fdac95c14c1c692
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Thu, 10 Mar 2022 16:59:56 +0300

Added warning in log if application-defined Content-Length is used

Diffstat:
Msrc/microhttpd/connection.c | 14+++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -1,7 +1,7 @@ /* This file is part of libmicrohttpd Copyright (C) 2007-2020 Daniel Pittman and Christian Grothoff - Copyright (C) 2015-2021 Evgeny Grin (Karlson2k) + Copyright (C) 2015-2022 Evgeny Grin (Karlson2k) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -5265,6 +5265,18 @@ MHD_queue_response (struct MHD_Connection *connection, } } +#ifdef HAVE_MESSAGES + if ( (0 != (MHD_RF_INSANITY_HEADER_CONTENT_LENGTH & response->flags)) && + (0 != (MHD_RAF_HAS_CONTENT_LENGTH & response->flags_auto)) ) + { + MHD_DLOG (daemon, + _ ("The response has application-defined \"Content-Length\" " \ + "header. The reply to the request will be not " \ + "HTTP-compliant and may result in hung connection or " \ + "other problems!\n")); + } +#endif + MHD_increment_response_rc (response); connection->response = response; connection->responseCode = status_code;