libmicrohttpd

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

commit 776fbecc38556725077a89845699802da5aea0f6
parent e1cf053c5c69845dbeac646dc6d60ae402079022
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Wed, 14 Sep 2016 17:37:35 +0000

HTTP Upgrade: adjusted socket buffering for Upgrade

Diffstat:
Msrc/microhttpd/connection.c | 13+++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -2876,14 +2876,11 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) case MHD_CONNECTION_HEADERS_SENT: /* Some clients may take some actions right after header receive */ if (MHD_NO != socket_flush_possible (connection)) - { - socket_start_no_buffering_flush (connection); - socket_start_extra_buffering (connection); - } - else - socket_start_normal_buffering (connection); + socket_start_no_buffering_flush (connection); + if (NULL != connection->response->upgrade_handler) { + socket_start_normal_buffering (connection); /* This connection is "upgraded". Pass socket to application. */ if (MHD_YES != MHD_response_execute_upgrade_ (connection->response, @@ -2897,6 +2894,10 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) connection->state = MHD_CONNECTION_UPGRADE; continue; } + if (MHD_NO != socket_flush_possible (connection)) + socket_start_extra_buffering (connection); + else + socket_start_normal_buffering (connection); if (connection->have_chunked_upload) connection->state = MHD_CONNECTION_CHUNKED_BODY_UNREADY;