[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] branch master updated: fix #7757
From: |
gnunet |
Subject: |
[libmicrohttpd] branch master updated: fix #7757 |
Date: |
Sun, 03 Sep 2023 00:25:25 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository libmicrohttpd.
The following commit(s) were added to refs/heads/master by this push:
new eb21a977 fix #7757
eb21a977 is described below
commit eb21a977d2b41628c4228ca097b24168574850d9
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Sun Sep 3 00:23:02 2023 +0200
fix #7757
---
ChangeLog | 5 +++++
src/microhttpd/connection.c | 13 +++++++++++--
src/microhttpd/internal.h | 7 +++++++
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3caf7105..905110cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Sep 3 12:23:18 AM CEST 2023
+ Prevent queueing of responses if connection is not currently in the
+ access handler callback (which was always not allowed per API spec,
+ but is now met with an appropriate error response). Fixes #7757. -CG
+
Web 29 Mar 2023 20:56:00 CEST
Bumped version as the hotfix was released based on the separate branch. -EG
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index bfe5b820..b7a9a31a 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -3674,6 +3674,7 @@ call_connection_handler (struct MHD_Connection
*connection)
return; /* already queued a response */
processed = 0;
connection->rq.client_aware = true;
+ connection->in_access_handler = true;
if (MHD_NO ==
daemon->default_handler (daemon->default_handler_cls,
connection,
@@ -3684,12 +3685,14 @@ call_connection_handler (struct MHD_Connection
*connection)
&processed,
&connection->rq.client_context))
{
+ connection->in_access_handler = false;
/* serious internal error, close connection */
CONNECTION_CLOSE_ERROR (connection,
_ ("Application reported internal error, " \
"closing connection."));
return;
}
+ connection->in_access_handler = false;
}
@@ -3898,6 +3901,7 @@ process_request_body (struct MHD_Connection *connection)
}
left_unprocessed = to_be_processed;
connection->rq.client_aware = true;
+ connection->in_access_handler = true;
if (MHD_NO ==
daemon->default_handler (daemon->default_handler_cls,
connection,
@@ -3908,12 +3912,15 @@ process_request_body (struct MHD_Connection *connection)
&left_unprocessed,
&connection->rq.client_context))
{
+ connection->in_access_handler = false;
/* serious internal error, close connection */
CONNECTION_CLOSE_ERROR (connection,
_ ("Application reported internal error, " \
"closing connection."));
return;
}
+ connection->in_access_handler = false;
+
if (left_unprocessed > to_be_processed)
MHD_PANIC (_ ("libmicrohttpd API violation.\n"));
@@ -7102,10 +7109,12 @@ MHD_queue_response (struct MHD_Connection *connection,
struct MHD_Daemon *daemon;
bool reply_icy;
- reply_icy = (0 != (status_code & MHD_ICY_FLAG));
- status_code &= ~MHD_ICY_FLAG;
if ((NULL == connection) || (NULL == response))
return MHD_NO;
+ if (! connection->in_access_handler)
+ return MHD_NO;
+ reply_icy = (0 != (status_code & MHD_ICY_FLAG));
+ status_code &= ~MHD_ICY_FLAG;
daemon = connection->daemon;
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 581f6864..56657e19 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -1575,6 +1575,13 @@ struct MHD_Connection
*/
bool suspended;
+ /**
+ * Are we currently in the #MHD_AccessHandlerCallback
+ * for this connection (and thus eligible to receive
+ * calls to #MHD_queue_response()?).
+ */
+ bool in_access_handler;
+
/**
* Is the connection wanting to resume?
*/
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libmicrohttpd] branch master updated: fix #7757,
gnunet <=