Check for SEND_AND_CLOSE after HANDSHAKE_REQUEST

Assume handshake request was declined if either MG_F_CLOSE_IMMEDIATELY _or_ MG_F_SEND_AND_CLOSE is set.

PUBLISHED_FROM=60af32a3f8890e826205465b9add2f58b1d46e5f
This commit is contained in:
Deomid Ryabkov 2016-11-28 17:45:38 +02:00 committed by Cesanta Bot
parent d6259332d4
commit 51466df7b9

View File

@ -5633,7 +5633,7 @@ void mg_http_handler(struct mg_connection *nc, int ev, void *ev_data) {
/* Send handshake */
mg_call(nc, nc->handler, MG_EV_WEBSOCKET_HANDSHAKE_REQUEST, hm);
if (!(nc->flags & MG_F_CLOSE_IMMEDIATELY)) {
if (!(nc->flags & (MG_F_CLOSE_IMMEDIATELY | MG_F_SEND_AND_CLOSE))) {
if (nc->send_mbuf.len == 0) {
mg_ws_handshake(nc, vec);
}