gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] branch master updated: add assertion to guard against ba


From: gnunet
Subject: [libmicrohttpd] branch master updated: add assertion to guard against bad behavior described in #7196, also document that after suspending one must return MHD_YES
Date: Wed, 08 Feb 2023 14:28:53 +0100

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 4627d005 add assertion to guard against bad behavior described in 
#7196, also document that after suspending one must return MHD_YES
4627d005 is described below

commit 4627d005d2ead3a3b7f34b25b9e6528d2f9ed99b
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Feb 8 14:28:42 2023 +0100

    add assertion to guard against bad behavior described in #7196, also 
document that after suspending one must return MHD_YES
---
 doc/libmicrohttpd.texi      | 5 +++++
 src/microhttpd/connection.c | 1 +
 2 files changed, 6 insertions(+)

diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
index b1ae347d..e1fc05bd 100644
--- a/doc/libmicrohttpd.texi
+++ b/doc/libmicrohttpd.texi
@@ -3036,6 +3036,11 @@ The only safe time to suspend a connection is from the
 response object must not be shared among multiple
 connections).
 
+When suspending from the @code{MHD_AccessHandlerCallback}
+you MUST afterwards return @code{MHD_YES} from the access handler
+callback (as MHD_NO would imply to both close and suspend
+the connection, which is not allowed).
+
 Finally, it is an API violation to call @code{MHD_stop_daemon} while
 having suspended connections (this will at least create memory and
 socket leaks or lead to undefined behavior).  You must explicitly
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index b983e7ed..ddf62d77 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -868,6 +868,7 @@ MHD_connection_close_ (struct MHD_Connection *connection,
   struct MHD_Daemon *daemon = connection->daemon;
   struct MHD_Response *resp = connection->rp.response;
 
+  mhd_assert (! connection->suspended);
 #ifdef MHD_USE_THREADS
   mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \
                MHD_thread_ID_match_current_ (connection->pid) );

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]