Skip to content

Commit 0318700

Browse files
committed
m_requested_subprotocols wasn't getting populated. fixes #155
Thank you to robagar for finding this bug and jeffjcrowe for supplying a patch
1 parent 27a6d6f commit 0318700

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/roles/server.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,21 @@ void server<endpoint>::connection<connection_type>::handle_read_request(
614614
}
615615

616616
m_connection.m_processor->validate_handshake(m_request);
617+
618+
// Extract subprotocols
619+
std::string subprotocols = m_request.header("Sec-WebSocket-Protocol");
620+
if(subprotocols.length() > 0) {
621+
boost::char_separator<char> sep(",");
622+
boost::tokenizer< boost::char_separator<char> > tokens(subprotocols, sep);
623+
for(boost::tokenizer< boost::char_separator<char> >::iterator it = tokens.begin(); it != tokens.end(); ++it){
624+
std::string proto = *it;
625+
boost::trim(proto);
626+
if (proto.length() > 0){
627+
m_requested_subprotocols.push_back(proto);
628+
}
629+
}
630+
}
631+
617632
m_origin = m_connection.m_processor->get_origin(m_request);
618633
m_uri = m_connection.m_processor->get_uri(m_request);
619634

0 commit comments

Comments
 (0)