[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 01/07: connection.c: added function to check used reply
From: |
gnunet |
Subject: |
[libmicrohttpd] 01/07: connection.c: added function to check used reply |
Date: |
Mon, 07 Mar 2022 19:36:08 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit e9292a95ec87a3c4fe1c1662fae4b3cf8d887bbb
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Mar 4 15:52:06 2022 +0300
connection.c: added function to check used reply
Log warning if response has body, but no body is allowed for this
connection.
---
src/microhttpd/connection.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index f6a871c0..9e764b02 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -1814,6 +1814,32 @@ setup_reply_properties (struct MHD_Connection
*connection)
}
+/**
+ * Check whether queued response is suitable for @a connection.
+ * @param connection to connection to check
+ */
+static void
+check_connection_reply (struct MHD_Connection *connection)
+{
+ struct MHD_Connection *const c = connection; /**< a short alias */
+ struct MHD_Response *const r = c->response; /**< a short alias */
+ mhd_assert (c->rp_props.set);
+
+#ifdef HAVE_MESSAGES
+ if ((! c->rp_props.use_reply_body_headers) && (0 != r->total_size))
+ {
+ MHD_DLOG (c->daemon,
+ _ ("This reply with response code %u cannot use reply body. "
+ "Non-empty response body is ignored and not used.\n"),
+ (unsigned) (c->responseCode & (~MHD_ICY_FLAG)));
+ }
+#else
+ (void) c; /* Mute compiler warning */
+ (void) r; /* Mute compiler warning */
+#endif
+}
+
+
/**
* Append data to the buffer if enough space is available,
* update position.
@@ -2012,6 +2038,8 @@ build_header_response (struct MHD_Connection *connection)
! c->rp_props.use_reply_body_headers);
#endif /* UPGRADE_SUPPORT */
+ check_connection_reply (c);
+
rcode = (unsigned) (c->responseCode & (~MHD_ICY_FLAG));
if (MHD_CONN_MUST_CLOSE == c->keepalive)
{
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (02634d01 -> 1a46bfd6), gnunet, 2022/03/07
- [libmicrohttpd] 01/07: connection.c: added function to check used reply,
gnunet <=
- [libmicrohttpd] 07/07: memorypool: fixed: unpoison memory for ASAN before destroying pool, gnunet, 2022/03/07
- [libmicrohttpd] 04/07: response.c: fixed coding style, gnunet, 2022/03/07
- [libmicrohttpd] 03/07: response: added automatic flag MHD_RAF_HAS_CONTENT_LENGTH, gnunet, 2022/03/07
- [libmicrohttpd] 05/07: response headers: do not add automatic "Content-Length" header if response already has it, gnunet, 2022/03/07
- [libmicrohttpd] 06/07: reply: warn if manual "Content-Length" is used when this header is not allowed, gnunet, 2022/03/07
- [libmicrohttpd] 02/07: MHD_queue_response(): improved doxy, gnunet, 2022/03/07