From 0318700c0023e4f4c8ffbf10857ce10c37cffa0d Mon Sep 17 00:00:00 2001 From: Peter Thorson Date: Tue, 11 Dec 2012 07:07:25 -0600 Subject: [PATCH] m_requested_subprotocols wasn't getting populated. fixes #155 Thank you to robagar for finding this bug and jeffjcrowe for supplying a patch --- src/roles/server.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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);