From 0412fc0f40d874f7b6370713e9d02bf783e6c254 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 4 Oct 2021 22:53:38 +0100 Subject: Fix parsing the Sec-WebSocket-Protocol header. --- src/modules/m_websocket.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/modules/m_websocket.cpp') diff --git a/src/modules/m_websocket.cpp b/src/modules/m_websocket.cpp index 58ce8507d..c70fd2c73 100644 --- a/src/modules/m_websocket.cpp +++ b/src/modules/m_websocket.cpp @@ -415,9 +415,11 @@ class WebSocketHook : public IOHookMiddle HTTPHeaderFinder protocolheader; if (protocolheader.Find(recvq, "Sec-WebSocket-Protocol:", 23, reqend)) { - irc::spacesepstream protostream(protocolheader.ExtractValue(recvq)); + irc::commasepstream protostream(protocolheader.ExtractValue(recvq)); for (std::string proto; protostream.GetToken(proto); ) { + proto.erase(std::remove_if(proto.begin(), proto.end(), ::isspace), proto.end()); + bool is_binary = stdalgo::string::equalsci(proto, "binary.inspircd.org"); bool is_text = stdalgo::string::equalsci(proto, "text.inspircd.org"); -- cgit v1.3.1-10-gc9f91