summaryrefslogtreecommitdiff
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)
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)
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;