aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_websocket.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-10-04 22:53:38 +0100
committerGravatar Sadie Powell2021-10-04 22:53:38 +0100
commit0412fc0f40d874f7b6370713e9d02bf783e6c254 (patch)
treecd0eaa3736ab7e094a1ecf85632eff3a3800fe34 /src/modules/m_websocket.cpp
parentMove the ParseStack constructor out of the header. (diff)
downloadinspircd++-0412fc0f40d874f7b6370713e9d02bf783e6c254.tar.gz
inspircd++-0412fc0f40d874f7b6370713e9d02bf783e6c254.tar.bz2
inspircd++-0412fc0f40d874f7b6370713e9d02bf783e6c254.zip
Fix parsing the Sec-WebSocket-Protocol header.
Diffstat (limited to 'src/modules/m_websocket.cpp')
-rw-r--r--src/modules/m_websocket.cpp4
1 files changed, 3 insertions, 1 deletions
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");