aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/connection_https.c
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2017-06-05 22:31:48 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2017-06-05 23:01:56 +0300
commitde669ead802049bb06f9672aa873b424b8201727 (patch)
tree109a9f20005dae8fca43f4fb0993b22334fe27bf /src/microhttpd/connection_https.c
parent1d356a1f480dc11eef0bfe374ee21ea2ecc5ca7a (diff)
downloadlibmicrohttpd-de669ead802049bb06f9672aa873b424b8201727.tar.gz
libmicrohttpd-de669ead802049bb06f9672aa873b424b8201727.zip
Merged MHD_tls_connection_handle_read() into MHD_connection_handle_read()
Diffstat (limited to 'src/microhttpd/connection_https.c')
-rw-r--r--src/microhttpd/connection_https.c35
1 files changed, 3 insertions, 32 deletions
diff --git a/src/microhttpd/connection_https.c b/src/microhttpd/connection_https.c
index 9e7c1953..c168d543 100644
--- a/src/microhttpd/connection_https.c
+++ b/src/microhttpd/connection_https.c
@@ -143,8 +143,8 @@ send_tls_adapter (struct MHD_Connection *connection,
143 * false is handshake in progress or in case 143 * false is handshake in progress or in case
144 * of error 144 * of error
145 */ 145 */
146static bool 146bool
147run_tls_handshake (struct MHD_Connection *connection) 147MHD_run_tls_handshake_ (struct MHD_Connection *connection)
148{ 148{
149 int ret; 149 int ret;
150 150
@@ -181,34 +181,6 @@ run_tls_handshake (struct MHD_Connection *connection)
181 181
182 182
183/** 183/**
184 * This function handles a particular SSL/TLS connection when
185 * it has been determined that there is data to be read off a
186 * socket. Message processing is done by message type which is
187 * determined by peeking into the first message type byte of the
188 * stream.
189 *
190 * Error message handling: all fatal level messages cause the
191 * connection to be terminated.
192 *
193 * Application data is forwarded to the underlying daemon for
194 * processing.
195 *
196 * @param connection the source connection
197 * @return always #MHD_YES (we should continue to process the connection)
198 */
199static int
200MHD_tls_connection_handle_read (struct MHD_Connection *connection)
201{
202 if (MHD_TLS_CONN_CONNECTED > connection->tls_state)
203 {
204 if (!run_tls_handshake(connection))
205 return MHD_YES;
206 }
207 return MHD_connection_handle_read (connection);
208}
209
210
211/**
212 * This function was created to handle writes to sockets when it has 184 * This function was created to handle writes to sockets when it has
213 * been determined that the socket can be written to. This function 185 * been determined that the socket can be written to. This function
214 * will forward all write requests to the underlying daemon unless 186 * will forward all write requests to the underlying daemon unless
@@ -221,7 +193,7 @@ MHD_tls_connection_handle_write (struct MHD_Connection *connection)
221{ 193{
222 if (MHD_TLS_CONN_CONNECTED > connection->tls_state) 194 if (MHD_TLS_CONN_CONNECTED > connection->tls_state)
223 { 195 {
224 if (!run_tls_handshake(connection)) 196 if (!MHD_run_tls_handshake_(connection))
225 return MHD_YES; 197 return MHD_YES;
226 } 198 }
227 return MHD_connection_handle_write (connection); 199 return MHD_connection_handle_write (connection);
@@ -237,7 +209,6 @@ MHD_tls_connection_handle_write (struct MHD_Connection *connection)
237void 209void
238MHD_set_https_callbacks (struct MHD_Connection *connection) 210MHD_set_https_callbacks (struct MHD_Connection *connection)
239{ 211{
240 connection->read_handler = &MHD_tls_connection_handle_read;
241 connection->write_handler = &MHD_tls_connection_handle_write; 212 connection->write_handler = &MHD_tls_connection_handle_write;
242 connection->recv_cls = &recv_tls_adapter; 213 connection->recv_cls = &recv_tls_adapter;
243 connection->send_cls = &send_tls_adapter; 214 connection->send_cls = &send_tls_adapter;