libmicrohttpd

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

commit 56a7664a729419a08ae3223a48ef0fad1cca4369
parent 406c434c722668687d7d752c8d2b6054d4340f3d
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Mon,  7 Mar 2022 21:27:58 +0300

reply: warn if manual "Content-Length" is used when this header is not allowed

Diffstat:
Msrc/microhttpd/connection.c | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -1833,6 +1833,15 @@ check_connection_reply (struct MHD_Connection *connection) "Non-empty response body is ignored and not used.\n"), (unsigned) (c->responseCode & (~MHD_ICY_FLAG))); } + if ( (! c->rp_props.use_reply_body_headers) && + (0 != (r->flags_auto & MHD_RAF_HAS_CONTENT_LENGTH)) ) + { + MHD_DLOG (c->daemon, + _ ("This reply with response code %u cannot use reply body. " + "Application defined \"Content-Length\" header violates" + "HTTP specification.\n"), + (unsigned) (c->responseCode & (~MHD_ICY_FLAG))); + } #else (void) c; /* Mute compiler warning */ (void) r; /* Mute compiler warning */