aboutsummaryrefslogtreecommitdiff
path: root/src/lib/connection_add.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/connection_add.c')
-rw-r--r--src/lib/connection_add.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/lib/connection_add.c b/src/lib/connection_add.c
index 94d37442..fbd7b85f 100644
--- a/src/lib/connection_add.c
+++ b/src/lib/connection_add.c
@@ -24,6 +24,48 @@
24#include "internal.h" 24#include "internal.h"
25#include "connection_add.h" 25#include "connection_add.h"
26#include "daemon_ip_limit.h" 26#include "daemon_ip_limit.h"
27#include "daemon_select.h"
28#include "daemon_poll.h"
29
30
31#ifdef UPGRADE_SUPPORT
32/**
33 * Main function of the thread that handles an individual connection
34 * after it was "upgraded" when #MHD_USE_THREAD_PER_CONNECTION is set.
35 * @remark To be called only from thread that process
36 * connection's recv(), send() and response.
37 *
38 * @param con the connection this thread will handle
39 */
40static void
41thread_main_connection_upgrade (struct MHD_Connection *con)
42{
43#ifdef HTTPS_SUPPORT
44 struct MHD_UpgradeResponseHandle *urh = con->request.urh;
45 struct MHD_Daemon *daemon = con->daemon;
46
47 /* Here, we need to bi-directionally forward
48 until the application tells us that it is done
49 with the socket; */
50 if ( (NULL != daemon->tls_api) &&
51 (MHD_ELS_POLL != daemon->event_loop_syscall) )
52 {
53 MHD_daemon_upgrade_connection_with_select (con);
54 }
55#ifdef HAVE_POLL
56 else if (NULL != daemon->tls_api)
57 {
58 MHD_daemon_upgrade_connection_with_poll_ (con);
59 }
60#endif
61 /* end HTTPS */
62#endif /* HTTPS_SUPPORT */
63 /* TLS forwarding was finished. Cleanup socketpair. */
64 MHD_connection_finish_forward_ (con);
65 /* Do not set 'urh->clean_ready' yet as 'urh' will be used
66 * in connection thread for a little while. */
67}
68#endif /* UPGRADE_SUPPORT */
27 69
28 70
29/** 71/**