diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-02-27 23:28:01 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-02-27 23:28:01 +0100 |
commit | fc495439b4e78c021bf25dce3609f47061e8c658 (patch) | |
tree | 1659efae34d23d65f6b0d0e628aaf531608dc0ad | |
parent | 46bbae5663de2e71f613728df2e0849bfcfb573e (diff) | |
download | libmicrohttpd-fc495439b4e78c021bf25dce3609f47061e8c658.tar.gz libmicrohttpd-fc495439b4e78c021bf25dce3609f47061e8c658.zip |
call completion handler also for upgrade connections
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/include/microhttpd.h | 2 | ||||
-rw-r--r-- | src/lib/action_from_response.c | 1 | ||||
-rw-r--r-- | src/lib/request_resume.c | 8 | ||||
-rw-r--r-- | src/microhttpd/daemon.c | 12 |
5 files changed, 18 insertions, 9 deletions
@@ -1,3 +1,7 @@ | |||
1 | Tue Feb 27 23:27:02 CET 2018 | ||
2 | Ensure MHD_RequestCompletedCallback is also called for | ||
3 | upgraded connections. -CG | ||
4 | |||
1 | Fri Feb 16 03:09:33 CET 2018 | 5 | Fri Feb 16 03:09:33 CET 2018 |
2 | Fixing #5278 as suggested by reporter. -CG/texec | 6 | Fixing #5278 as suggested by reporter. -CG/texec |
3 | 7 | ||
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index 3af9cf22..77bb000c 100644 --- a/src/include/microhttpd.h +++ b/src/include/microhttpd.h | |||
@@ -126,7 +126,7 @@ typedef intptr_t ssize_t; | |||
126 | * Current version of the library. | 126 | * Current version of the library. |
127 | * 0x01093001 = 1.9.30-1. | 127 | * 0x01093001 = 1.9.30-1. |
128 | */ | 128 | */ |
129 | #define MHD_VERSION 0x00095901 | 129 | #define MHD_VERSION 0x00095902 |
130 | 130 | ||
131 | /** | 131 | /** |
132 | * MHD-internal return code for "YES". | 132 | * MHD-internal return code for "YES". |
diff --git a/src/lib/action_from_response.c b/src/lib/action_from_response.c index 007363fb..43f33cb5 100644 --- a/src/lib/action_from_response.c +++ b/src/lib/action_from_response.c | |||
@@ -23,6 +23,7 @@ | |||
23 | * @author Christian Grothoff | 23 | * @author Christian Grothoff |
24 | */ | 24 | */ |
25 | #include "internal.h" | 25 | #include "internal.h" |
26 | #include "connection_call_handlers.h" | ||
26 | 27 | ||
27 | 28 | ||
28 | /** | 29 | /** |
diff --git a/src/lib/request_resume.c b/src/lib/request_resume.c index 8a231292..5742f6ac 100644 --- a/src/lib/request_resume.c +++ b/src/lib/request_resume.c | |||
@@ -23,7 +23,7 @@ | |||
23 | * @author Christian Grothoff | 23 | * @author Christian Grothoff |
24 | */ | 24 | */ |
25 | #include "internal.h" | 25 | #include "internal.h" |
26 | 26 | #include "connection_close.h" | |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * Resume handling of network data for suspended request. It is | 29 | * Resume handling of network data for suspended request. It is |
@@ -43,7 +43,7 @@ void | |||
43 | MHD_request_resume (struct MHD_Request *request) | 43 | MHD_request_resume (struct MHD_Request *request) |
44 | { | 44 | { |
45 | struct MHD_Daemon *daemon = request->daemon; | 45 | struct MHD_Daemon *daemon = request->daemon; |
46 | 46 | ||
47 | if (daemon->disallow_suspend_resume) | 47 | if (daemon->disallow_suspend_resume) |
48 | MHD_PANIC (_("Cannot resume connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n")); | 48 | MHD_PANIC (_("Cannot resume connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n")); |
49 | MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); | 49 | MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); |
@@ -81,7 +81,7 @@ MHD_resume_suspended_connections_ (struct MHD_Daemon *daemon) | |||
81 | struct MHD_Connection *prev = NULL; | 81 | struct MHD_Connection *prev = NULL; |
82 | bool ret; | 82 | bool ret; |
83 | const bool used_thr_p_c = (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_model); | 83 | const bool used_thr_p_c = (MHD_TM_THREAD_PER_CONNECTION == daemon->threading_model); |
84 | 84 | ||
85 | mhd_assert (NULL == daemon->worker_pool); | 85 | mhd_assert (NULL == daemon->worker_pool); |
86 | ret = false; | 86 | ret = false; |
87 | MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); | 87 | MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); |
@@ -159,6 +159,8 @@ MHD_resume_suspended_connections_ (struct MHD_Daemon *daemon) | |||
159 | /* Data forwarding was finished (for TLS connections) AND | 159 | /* Data forwarding was finished (for TLS connections) AND |
160 | * application was closed upgraded connection. | 160 | * application was closed upgraded connection. |
161 | * Insert connection into cleanup list. */ | 161 | * Insert connection into cleanup list. */ |
162 | MHD_connection_close_ (pos, | ||
163 | MHD_CONNECTION_NOTIFY_CLOSED); | ||
162 | DLL_insert (daemon->cleanup_head, | 164 | DLL_insert (daemon->cleanup_head, |
163 | daemon->cleanup_tail, | 165 | daemon->cleanup_tail, |
164 | pos); | 166 | pos); |
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index b6906459..14cc0121 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -2678,7 +2678,7 @@ void | |||
2678 | MHD_resume_connection (struct MHD_Connection *connection) | 2678 | MHD_resume_connection (struct MHD_Connection *connection) |
2679 | { | 2679 | { |
2680 | struct MHD_Daemon *daemon = connection->daemon; | 2680 | struct MHD_Daemon *daemon = connection->daemon; |
2681 | 2681 | ||
2682 | if (0 == (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) | 2682 | if (0 == (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) |
2683 | MHD_PANIC (_("Cannot resume connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n")); | 2683 | MHD_PANIC (_("Cannot resume connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n")); |
2684 | MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); | 2684 | MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); |
@@ -2790,6 +2790,8 @@ resume_suspended_connections (struct MHD_Daemon *daemon) | |||
2790 | /* Data forwarding was finished (for TLS connections) AND | 2790 | /* Data forwarding was finished (for TLS connections) AND |
2791 | * application was closed upgraded connection. | 2791 | * application was closed upgraded connection. |
2792 | * Insert connection into cleanup list. */ | 2792 | * Insert connection into cleanup list. */ |
2793 | MHD_connection_close_ (pos, | ||
2794 | MHD_REQUEST_TERMINATED_COMPLETED_OK); | ||
2793 | DLL_insert (daemon->cleanup_head, | 2795 | DLL_insert (daemon->cleanup_head, |
2794 | daemon->cleanup_tail, | 2796 | daemon->cleanup_tail, |
2795 | pos); | 2797 | pos); |
@@ -5425,7 +5427,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
5425 | MHD_DLOG (daemon, _("Using debug build of libmicrohttpd.\n") ); | 5427 | MHD_DLOG (daemon, _("Using debug build of libmicrohttpd.\n") ); |
5426 | #endif /* HAVE_MESSAGES */ | 5428 | #endif /* HAVE_MESSAGES */ |
5427 | #endif /* ! NDEBUG */ | 5429 | #endif /* ! NDEBUG */ |
5428 | 5430 | ||
5429 | if ( (0 != (*pflags & MHD_USE_ITC)) && | 5431 | if ( (0 != (*pflags & MHD_USE_ITC)) && |
5430 | (0 == daemon->worker_pool_size) ) | 5432 | (0 == daemon->worker_pool_size) ) |
5431 | { | 5433 | { |
@@ -5527,7 +5529,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
5527 | { | 5529 | { |
5528 | /* try to open listen socket */ | 5530 | /* try to open listen socket */ |
5529 | int domain; | 5531 | int domain; |
5530 | 5532 | ||
5531 | #ifdef HAVE_INET6 | 5533 | #ifdef HAVE_INET6 |
5532 | domain = (*pflags & MHD_USE_IPv6) ? PF_INET6 : PF_INET; | 5534 | domain = (*pflags & MHD_USE_IPv6) ? PF_INET6 : PF_INET; |
5533 | #else /* ! HAVE_INET6 */ | 5535 | #else /* ! HAVE_INET6 */ |
@@ -5535,7 +5537,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
5535 | goto free_and_fail; | 5537 | goto free_and_fail; |
5536 | domain = PF_INET; | 5538 | domain = PF_INET; |
5537 | #endif /* ! HAVE_INET6 */ | 5539 | #endif /* ! HAVE_INET6 */ |
5538 | 5540 | ||
5539 | listen_fd = MHD_socket_create_listen_(domain); | 5541 | listen_fd = MHD_socket_create_listen_(domain); |
5540 | if (MHD_INVALID_SOCKET == listen_fd) | 5542 | if (MHD_INVALID_SOCKET == listen_fd) |
5541 | { | 5543 | { |
@@ -6358,7 +6360,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon) | |||
6358 | #endif /* HAVE_LISTEN_SHUTDOWN */ | 6360 | #endif /* HAVE_LISTEN_SHUTDOWN */ |
6359 | mhd_assert (false); /* Should never happen */ | 6361 | mhd_assert (false); /* Should never happen */ |
6360 | } | 6362 | } |
6361 | 6363 | ||
6362 | if (! MHD_join_thread_ (daemon->pid.handle)) | 6364 | if (! MHD_join_thread_ (daemon->pid.handle)) |
6363 | { | 6365 | { |
6364 | MHD_PANIC (_("Failed to join a thread\n")); | 6366 | MHD_PANIC (_("Failed to join a thread\n")); |