diff --git a/src/roles/server.hpp b/src/roles/server.hpp index 48f4ef9690..4a3de4ab66 100644 --- a/src/roles/server.hpp +++ b/src/roles/server.hpp @@ -614,6 +614,21 @@ void server::connection::handle_read_request( } m_connection.m_processor->validate_handshake(m_request); + + // Extract subprotocols + std::string subprotocols = m_request.header("Sec-WebSocket-Protocol"); + if(subprotocols.length() > 0) { + boost::char_separator sep(","); + boost::tokenizer< boost::char_separator > tokens(subprotocols, sep); + for(boost::tokenizer< boost::char_separator >::iterator it = tokens.begin(); it != tokens.end(); ++it){ + std::string proto = *it; + boost::trim(proto); + if (proto.length() > 0){ + m_requested_subprotocols.push_back(proto); + } + } + } + m_origin = m_connection.m_processor->get_origin(m_request); m_uri = m_connection.m_processor->get_uri(m_request);