diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index c0fb687b..1833b060 100644 --- 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 index c168d543..19d6db59 100644 --- a/src/microhttpd/connection_https.c +++ b/src/microhttpd/connection_https.c @@ -180,26 +180,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 index d54cdbf5..cb7064a4 100644 --- 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 index 90c7259f..7a47651e 100644 --- a/src/microhttpd/internal.h +++ b/src/microhttpd/internal.h @@ -930,12 +930,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. */