diff --git a/src/ws_engine.cpp b/src/ws_engine.cpp index d3b02bee..cb5510e1 100644 --- a/src/ws_engine.cpp +++ b/src/ws_engine.cpp @@ -454,17 +454,17 @@ bool zmq::ws_engine_t::server_handshake () _header_upgrade_websocket = strcasecmp ("websocket", _header_value) == 0; else if (strcasecmp ("connection", _header_name) == 0){ - char *element = strtok (_header_value, ","); - while (element != NULL){ - while (*element == ' ') - element++; + char *element = strtok (_header_value, ","); + while (element != NULL){ + while (*element == ' ') + element++; if (strcasecmp ("upgrade", element) == 0){ - _header_connection_upgrade = true; - break; - } - element = strtok (NULL, ","); - } - } + _header_connection_upgrade = true; + break; + } + element = strtok (NULL, ","); + } + } else if (strcasecmp ("Sec-WebSocket-Key", _header_name) == 0) strcpy_s (_websocket_key, _header_value);