Commit af504922 authored by Alex Hultman's avatar Alex Hultman Committed by GitHub

Select first subprotocol if many

parent 4f99c9bf
......@@ -234,6 +234,13 @@ void HttpSocket<isServer>::upgrade(const char *secKey, const char *extensions, s
memcpy(upgradeBuffer + upgradeResponseLength + 26 + extensionsResponse.length(), "\r\n", 2);
upgradeResponseLength += 26 + extensionsResponse.length() + 2;
}
// select first protocol
for (int i = 0; i < subprotocolLength; i++) {
if (subprotocol[i] == ',') {
subprotocolLength = i;
break;
}
}
if (subprotocolLength && subprotocolLength < 200) {
memcpy(upgradeBuffer + upgradeResponseLength, "Sec-WebSocket-Protocol: ", 24);
memcpy(upgradeBuffer + upgradeResponseLength + 24, subprotocol, subprotocolLength);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment