commit fc495439b4e78c021bf25dce3609f47061e8c658
parent 46bbae5663de2e71f613728df2e0849bfcfb573e
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 27 Feb 2018 23:28:01 +0100
call completion handler also for upgrade connections
Diffstat:
5 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,7 @@
+Tue Feb 27 23:27:02 CET 2018
+ Ensure MHD_RequestCompletedCallback is also called for
+ upgraded connections. -CG
+
Fri Feb 16 03:09:33 CET 2018
Fixing #5278 as suggested by reporter. -CG/texec
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
@@ -126,7 +126,7 @@ typedef intptr_t ssize_t;
* Current version of the library.
* 0x01093001 = 1.9.30-1.
*/
-#define MHD_VERSION 0x00095901
+#define MHD_VERSION 0x00095902
/**
* MHD-internal return code for "YES".
diff --git a/src/lib/action_from_response.c b/src/lib/action_from_response.c
@@ -23,6 +23,7 @@
* @author Christian Grothoff
*/
#include "internal.h"
+#include "connection_call_handlers.h"
/**
diff --git a/src/lib/request_resume.c b/src/lib/request_resume.c
@@ -23,7 +23,7 @@
* @author Christian Grothoff
*/
#include "internal.h"
-
+#include "connection_close.h"
/**
* Resume handling of network data for suspended request. It is
@@ -43,7 +43,7 @@ void
MHD_request_resume (struct MHD_Request *request)
{
struct MHD_Daemon *daemon = request->daemon;
-
+
if (daemon->disallow_suspend_resume)
MHD_PANIC (_("Cannot resume connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n"));
MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
@@ -81,7 +81,7 @@ MHD_resume_suspended_connections_ (struct MHD_Daemon *daemon)
struct MHD_Connection *prev = NULL;
bool ret;
const bool used_thr_p_c = (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_model);
-
+
mhd_assert (NULL == daemon->worker_pool);
ret = false;
MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
@@ -159,6 +159,8 @@ MHD_resume_suspended_connections_ (struct MHD_Daemon *daemon)
/* Data forwarding was finished (for TLS connections) AND
* application was closed upgraded connection.
* Insert connection into cleanup list. */
+ MHD_connection_close_ (pos,
+ MHD_CONNECTION_NOTIFY_CLOSED);
DLL_insert (daemon->cleanup_head,
daemon->cleanup_tail,
pos);
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
@@ -2678,7 +2678,7 @@ void
MHD_resume_connection (struct MHD_Connection *connection)
{
struct MHD_Daemon *daemon = connection->daemon;
-
+
if (0 == (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME))
MHD_PANIC (_("Cannot resume connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n"));
MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
@@ -2790,6 +2790,8 @@ resume_suspended_connections (struct MHD_Daemon *daemon)
/* Data forwarding was finished (for TLS connections) AND
* application was closed upgraded connection.
* Insert connection into cleanup list. */
+ MHD_connection_close_ (pos,
+ MHD_REQUEST_TERMINATED_COMPLETED_OK);
DLL_insert (daemon->cleanup_head,
daemon->cleanup_tail,
pos);
@@ -5425,7 +5427,7 @@ MHD_start_daemon_va (unsigned int flags,
MHD_DLOG (daemon, _("Using debug build of libmicrohttpd.\n") );
#endif /* HAVE_MESSAGES */
#endif /* ! NDEBUG */
-
+
if ( (0 != (*pflags & MHD_USE_ITC)) &&
(0 == daemon->worker_pool_size) )
{
@@ -5527,7 +5529,7 @@ MHD_start_daemon_va (unsigned int flags,
{
/* try to open listen socket */
int domain;
-
+
#ifdef HAVE_INET6
domain = (*pflags & MHD_USE_IPv6) ? PF_INET6 : PF_INET;
#else /* ! HAVE_INET6 */
@@ -5535,7 +5537,7 @@ MHD_start_daemon_va (unsigned int flags,
goto free_and_fail;
domain = PF_INET;
#endif /* ! HAVE_INET6 */
-
+
listen_fd = MHD_socket_create_listen_(domain);
if (MHD_INVALID_SOCKET == listen_fd)
{
@@ -6358,7 +6360,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
#endif /* HAVE_LISTEN_SHUTDOWN */
mhd_assert (false); /* Should never happen */
}
-
+
if (! MHD_join_thread_ (daemon->pid.handle))
{
MHD_PANIC (_("Failed to join a thread\n"));