GNU libmicrohttpd 0.9.77
Loading...
Searching...
No Matches
connection_finish_forward.c
Go to the documentation of this file.
1/*
2 This file is part of libmicrohttpd
3 Copyright (C) 2007-2018 Daniel Pittman and Christian Grothoff
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*/
24#include "internal.h"
26
27
28#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT)
39void
41{
42 struct MHD_Daemon *daemon = connection->daemon;
43 struct MHD_UpgradeResponseHandle *urh = connection->request.urh;
44
45 if (NULL == daemon->tls_api)
46 return; /* Nothing to do with non-TLS connection. */
47
48 if (MHD_TM_THREAD_PER_CONNECTION != daemon->threading_mode)
49 DLL_remove (daemon->urh_head,
50 daemon->urh_tail,
51 urh);
52#if EPOLL_SUPPORT
53 if ( (MHD_ELS_EPOLL == daemon->event_loop_syscall) &&
54 (0 != epoll_ctl (daemon->epoll_upgrade_fd,
55 EPOLL_CTL_DEL,
56 connection->socket_fd,
57 NULL)) )
58 {
59 MHD_PANIC (_ ("Failed to remove FD from epoll set.\n"));
60 }
61 if (urh->in_eready_list)
62 {
63 EDLL_remove (daemon->eready_urh_head,
64 daemon->eready_urh_tail,
65 urh);
66 urh->in_eready_list = false;
67 }
68#endif /* EPOLL_SUPPORT */
69 if (MHD_INVALID_SOCKET != urh->mhd.socket)
70 {
71#if EPOLL_SUPPORT
72 if ( (MHD_ELS_EPOLL == daemon->event_loop_syscall) &&
73 (0 != epoll_ctl (daemon->epoll_upgrade_fd,
74 EPOLL_CTL_DEL,
75 urh->mhd.socket,
76 NULL)) )
77 {
78 MHD_PANIC (_ ("Failed to remove FD from epoll set.\n"));
79 }
80#endif /* EPOLL_SUPPORT */
81 /* Reflect remote disconnect to application by breaking
82 * socketpair connection. */
83 shutdown (urh->mhd.socket,
84 SHUT_RDWR);
85 }
86 /* Socketpair sockets will remain open as they will be
87 * used with MHD_UPGRADE_ACTION_CLOSE. They will be
88 * closed by MHD_cleanup_upgraded_connection_() during
89 * connection's final cleanup.
90 */}
91
92
93#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT*/
94
95/* end of connection_finish_forward.c */
#define MHD_connection_finish_forward_(conn)
Definition connection.h:165
complete upgrade socket forwarding operation in TLS mode
#define MHD_PANIC(msg)
Definition internal.h:69
#define EDLL_remove(head, tail, element)
Definition internal.h:1847
#define DLL_remove(head, tail, element)
Definition internal.h:1763
#define NULL
#define _(String)
Definition mhd_options.h:42
MHD internal shared structures.
#define MHD_INVALID_SOCKET
Definition microhttpd.h:208
MHD_socket socket_fd
Definition internal.h:752
struct MHD_Request request
Definition internal.h:717
struct MHD_Daemon * daemon
Definition internal.h:675
enum MHD_EventLoopSyscall event_loop_syscall
Definition internal.h:1436
enum MHD_ThreadingMode threading_mode
Definition internal.h:1417