libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 237330045b9085a75aeaee94d8d274ec9cecb9fd
parent de669ead802049bb06f9672aa873b424b8201727
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Mon,  5 Jun 2017 23:00:52 +0300

Merged MHD_tls_connection_handle_write() into MHD_connection_handle_write()

Diffstat:
Msrc/microhttpd/connection.c | 12+++++++++++-
Msrc/microhttpd/connection_https.c | 21---------------------
Msrc/microhttpd/daemon.c | 6+++---
Msrc/microhttpd/internal.h | 6------
4 files changed, 14 insertions(+), 31 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -2783,6 +2783,17 @@ MHD_connection_handle_write (struct MHD_Connection *connection) if (connection->suspended) return MHD_YES; +#ifdef HTTPS_SUPPORT + if (MHD_TLS_CONN_NO_TLS != connection->tls_state) + { /* HTTPS connection. */ + if (MHD_TLS_CONN_CONNECTED > connection->tls_state) + { + if (!MHD_run_tls_handshake_ (connection)) + return MHD_YES; + } + } +#endif /* HTTPS_SUPPORT */ + while (1) { #if DEBUG_STATES @@ -3635,7 +3646,6 @@ MHD_connection_epoll_update_ (struct MHD_Connection *connection) void MHD_set_http_callbacks_ (struct MHD_Connection *connection) { - connection->write_handler = &MHD_connection_handle_write; connection->recv_cls = &recv_param_adapter; connection->send_cls = &send_param_adapter; } diff --git a/src/microhttpd/connection_https.c b/src/microhttpd/connection_https.c @@ -181,26 +181,6 @@ MHD_run_tls_handshake_ (struct MHD_Connection *connection) /** - * This function was created to handle writes to sockets when it has - * been determined that the socket can be written to. This function - * will forward all write requests to the underlying daemon unless - * the connection has been marked for closing. - * - * @return always #MHD_YES (we should continue to process the connection) - */ -static int -MHD_tls_connection_handle_write (struct MHD_Connection *connection) -{ - if (MHD_TLS_CONN_CONNECTED > connection->tls_state) - { - if (!MHD_run_tls_handshake_(connection)) - return MHD_YES; - } - return MHD_connection_handle_write (connection); -} - - -/** * Set connection callback function to be used through out * the processing of this secure connection. * @@ -209,7 +189,6 @@ MHD_tls_connection_handle_write (struct MHD_Connection *connection) void MHD_set_https_callbacks (struct MHD_Connection *connection) { - connection->write_handler = &MHD_tls_connection_handle_write; connection->recv_cls = &recv_tls_adapter; connection->send_cls = &send_tls_adapter; } diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -1052,7 +1052,7 @@ call_handlers (struct MHD_Connection *con, if ( (MHD_EVENT_LOOP_INFO_WRITE == con->event_loop_info) && write_ready) { - con->write_handler (con); + MHD_connection_handle_write (con); ret = MHD_connection_handle_idle (con); states_info_processed = true; } @@ -1083,7 +1083,7 @@ call_handlers (struct MHD_Connection *con, { if (MHD_CONNECTION_HEADERS_SENDING == con->state) { - con->write_handler (con); + MHD_connection_handle_write (con); /* Always call 'MHD_connection_handle_idle()' after each read/write. */ ret = MHD_connection_handle_idle (con); } @@ -1093,7 +1093,7 @@ call_handlers (struct MHD_Connection *con, if ((MHD_CONNECTION_NORMAL_BODY_READY == con->state) || (MHD_CONNECTION_CHUNKED_BODY_READY == con->state)) { - con->write_handler (con); + MHD_connection_handle_write (con); ret = MHD_connection_handle_idle (con); } } diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h @@ -931,12 +931,6 @@ struct MHD_Connection uint64_t current_chunk_offset; /** - * Handler used for processing write connection operations - * @sa #MHD_connection_handle_write, #MHD_tls_connection_handle_write - */ - int (*write_handler) (struct MHD_Connection *connection); - - /** * Function used for reading HTTP request stream. */ ReceiveCallback recv_cls;