aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-09-14 17:37:35 +0000
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-09-14 17:37:35 +0000
commit776fbecc38556725077a89845699802da5aea0f6 (patch)
treec3287b572bbe59cbc690d8c328840b634d4cc03f
parente1cf053c5c69845dbeac646dc6d60ae402079022 (diff)
downloadlibmicrohttpd-776fbecc38556725077a89845699802da5aea0f6.tar.gz
libmicrohttpd-776fbecc38556725077a89845699802da5aea0f6.zip
HTTP Upgrade: adjusted socket buffering for Upgrade
-rw-r--r--src/microhttpd/connection.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 15bdb70c..2fe9c64b 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2876,14 +2876,11 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
2876 case MHD_CONNECTION_HEADERS_SENT: 2876 case MHD_CONNECTION_HEADERS_SENT:
2877 /* Some clients may take some actions right after header receive */ 2877 /* Some clients may take some actions right after header receive */
2878 if (MHD_NO != socket_flush_possible (connection)) 2878 if (MHD_NO != socket_flush_possible (connection))
2879 { 2879 socket_start_no_buffering_flush (connection);
2880 socket_start_no_buffering_flush (connection); 2880
2881 socket_start_extra_buffering (connection);
2882 }
2883 else
2884 socket_start_normal_buffering (connection);
2885 if (NULL != connection->response->upgrade_handler) 2881 if (NULL != connection->response->upgrade_handler)
2886 { 2882 {
2883 socket_start_normal_buffering (connection);
2887 /* This connection is "upgraded". Pass socket to application. */ 2884 /* This connection is "upgraded". Pass socket to application. */
2888 if (MHD_YES != 2885 if (MHD_YES !=
2889 MHD_response_execute_upgrade_ (connection->response, 2886 MHD_response_execute_upgrade_ (connection->response,
@@ -2897,6 +2894,10 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
2897 connection->state = MHD_CONNECTION_UPGRADE; 2894 connection->state = MHD_CONNECTION_UPGRADE;
2898 continue; 2895 continue;
2899 } 2896 }
2897 if (MHD_NO != socket_flush_possible (connection))
2898 socket_start_extra_buffering (connection);
2899 else
2900 socket_start_normal_buffering (connection);
2900 2901
2901 if (connection->have_chunked_upload) 2902 if (connection->have_chunked_upload)
2902 connection->state = MHD_CONNECTION_CHUNKED_BODY_UNREADY; 2903 connection->state = MHD_CONNECTION_CHUNKED_BODY_UNREADY;